{ "version": "6", "dialect": "sqlite", "id": "ac451539-3830-4835-bd77-97953309ce51", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "auth_accounts": { "name": "auth_accounts", "columns": { "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "provider": { "name": "provider", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "provider_account_id": { "name": "provider_account_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "token_type": { "name": "token_type", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "session_state": { "name": "session_state", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "auth_accounts_user_id_users_id_fk": { "name": "auth_accounts_user_id_users_id_fk", "tableFrom": "auth_accounts", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": { "auth_accounts_provider_provider_account_id_pk": { "columns": [ "provider", "provider_account_id" ], "name": "auth_accounts_provider_provider_account_id_pk" } }, "uniqueConstraints": {}, "checkConstraints": {} }, "bank_accounts": { "name": "bank_accounts", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "owner_user_id": { "name": "owner_user_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'current'" }, "currency": { "name": "currency", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'GBP'" }, "opening_balance_minor": { "name": "opening_balance_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "opening_date": { "name": "opening_date", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "is_shared": { "name": "is_shared", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "is_archived": { "name": "is_archived", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "color": { "name": "color", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "bank_accounts_household_idx": { "name": "bank_accounts_household_idx", "columns": [ "household_id" ], "isUnique": false } }, "foreignKeys": { "bank_accounts_household_id_households_id_fk": { "name": "bank_accounts_household_id_households_id_fk", "tableFrom": "bank_accounts", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "bank_accounts_owner_user_id_users_id_fk": { "name": "bank_accounts_owner_user_id_users_id_fk", "tableFrom": "bank_accounts", "tableTo": "users", "columnsFrom": [ "owner_user_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "bank_connections": { "name": "bank_connections", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "provider": { "name": "provider", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "provider_institution_id": { "name": "provider_institution_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'pending'" }, "access_token_encrypted": { "name": "access_token_encrypted", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "refresh_token_encrypted": { "name": "refresh_token_encrypted", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": {}, "foreignKeys": { "bank_connections_household_id_households_id_fk": { "name": "bank_connections_household_id_households_id_fk", "tableFrom": "bank_connections", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "budgets": { "name": "budgets", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "category_id": { "name": "category_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "period": { "name": "period", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'monthly'" }, "amount_minor": { "name": "amount_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "start_date": { "name": "start_date", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "budgets_household_idx": { "name": "budgets_household_idx", "columns": [ "household_id" ], "isUnique": false } }, "foreignKeys": { "budgets_household_id_households_id_fk": { "name": "budgets_household_id_households_id_fk", "tableFrom": "budgets", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "budgets_category_id_categories_id_fk": { "name": "budgets_category_id_categories_id_fk", "tableFrom": "budgets", "tableTo": "categories", "columnsFrom": [ "category_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "categories": { "name": "categories", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "kind": { "name": "kind", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'expense'" }, "color": { "name": "color", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "icon": { "name": "icon", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "categories_household_idx": { "name": "categories_household_idx", "columns": [ "household_id" ], "isUnique": false } }, "foreignKeys": { "categories_household_id_households_id_fk": { "name": "categories_household_id_households_id_fk", "tableFrom": "categories", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "households": { "name": "households", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "base_currency": { "name": "base_currency", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'GBP'" }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "recurring_rules": { "name": "recurring_rules", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "bank_account_id": { "name": "bank_account_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "category_id": { "name": "category_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "amount_minor": { "name": "amount_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "rrule": { "name": "rrule", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "start_date": { "name": "start_date", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "end_date": { "name": "end_date", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "is_active": { "name": "is_active", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "recurring_rules_household_idx": { "name": "recurring_rules_household_idx", "columns": [ "household_id" ], "isUnique": false }, "recurring_rules_account_idx": { "name": "recurring_rules_account_idx", "columns": [ "bank_account_id" ], "isUnique": false } }, "foreignKeys": { "recurring_rules_household_id_households_id_fk": { "name": "recurring_rules_household_id_households_id_fk", "tableFrom": "recurring_rules", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "recurring_rules_bank_account_id_bank_accounts_id_fk": { "name": "recurring_rules_bank_account_id_bank_accounts_id_fk", "tableFrom": "recurring_rules", "tableTo": "bank_accounts", "columnsFrom": [ "bank_account_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "recurring_rules_category_id_categories_id_fk": { "name": "recurring_rules_category_id_categories_id_fk", "tableFrom": "recurring_rules", "tableTo": "categories", "columnsFrom": [ "category_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "savings_goals": { "name": "savings_goals", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "bank_account_id": { "name": "bank_account_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "target_amount_minor": { "name": "target_amount_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "current_amount_minor": { "name": "current_amount_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "target_date": { "name": "target_date", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "monthly_contribution_minor": { "name": "monthly_contribution_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "annual_interest_rate_bp": { "name": "annual_interest_rate_bp", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "goals_household_idx": { "name": "goals_household_idx", "columns": [ "household_id" ], "isUnique": false } }, "foreignKeys": { "savings_goals_household_id_households_id_fk": { "name": "savings_goals_household_id_households_id_fk", "tableFrom": "savings_goals", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "savings_goals_bank_account_id_bank_accounts_id_fk": { "name": "savings_goals_bank_account_id_bank_accounts_id_fk", "tableFrom": "savings_goals", "tableTo": "bank_accounts", "columnsFrom": [ "bank_account_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "sessions": { "name": "sessions", "columns": { "session_token": { "name": "session_token", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "expires": { "name": "expires", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "sessions_user_id_users_id_fk": { "name": "sessions_user_id_users_id_fk", "tableFrom": "sessions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "splits": { "name": "splits", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "transaction_id": { "name": "transaction_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "share_minor": { "name": "share_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "splits_transaction_idx": { "name": "splits_transaction_idx", "columns": [ "transaction_id" ], "isUnique": false } }, "foreignKeys": { "splits_transaction_id_transactions_id_fk": { "name": "splits_transaction_id_transactions_id_fk", "tableFrom": "splits", "tableTo": "transactions", "columnsFrom": [ "transaction_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "splits_user_id_users_id_fk": { "name": "splits_user_id_users_id_fk", "tableFrom": "splits", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "transactions": { "name": "transactions", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "bank_account_id": { "name": "bank_account_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "category_id": { "name": "category_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "recurring_rule_id": { "name": "recurring_rule_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "date": { "name": "date", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "amount_minor": { "name": "amount_minor", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "notes": { "name": "notes", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'posted'" }, "source": { "name": "source", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'manual'" }, "external_id": { "name": "external_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_by_user_id": { "name": "created_by_user_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "transactions_household_date_idx": { "name": "transactions_household_date_idx", "columns": [ "household_id", "date" ], "isUnique": false }, "transactions_account_date_idx": { "name": "transactions_account_date_idx", "columns": [ "bank_account_id", "date" ], "isUnique": false }, "transactions_rule_idx": { "name": "transactions_rule_idx", "columns": [ "recurring_rule_id" ], "isUnique": false }, "transactions_external_idx": { "name": "transactions_external_idx", "columns": [ "external_id" ], "isUnique": false } }, "foreignKeys": { "transactions_household_id_households_id_fk": { "name": "transactions_household_id_households_id_fk", "tableFrom": "transactions", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "transactions_bank_account_id_bank_accounts_id_fk": { "name": "transactions_bank_account_id_bank_accounts_id_fk", "tableFrom": "transactions", "tableTo": "bank_accounts", "columnsFrom": [ "bank_account_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "transactions_category_id_categories_id_fk": { "name": "transactions_category_id_categories_id_fk", "tableFrom": "transactions", "tableTo": "categories", "columnsFrom": [ "category_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "transactions_recurring_rule_id_recurring_rules_id_fk": { "name": "transactions_recurring_rule_id_recurring_rules_id_fk", "tableFrom": "transactions", "tableTo": "recurring_rules", "columnsFrom": [ "recurring_rule_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "transactions_created_by_user_id_users_id_fk": { "name": "transactions_created_by_user_id_users_id_fk", "tableFrom": "transactions", "tableTo": "users", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "users": { "name": "users", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email_verified": { "name": "email_verified", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "password_hash": { "name": "password_hash", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "household_id": { "name": "household_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'member'" }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(unixepoch() * 1000)" } }, "indexes": { "users_email_unique": { "name": "users_email_unique", "columns": [ "email" ], "isUnique": true } }, "foreignKeys": { "users_household_id_households_id_fk": { "name": "users_household_id_households_id_fk", "tableFrom": "users", "tableTo": "households", "columnsFrom": [ "household_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "verification_tokens": { "name": "verification_tokens", "columns": { "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "expires": { "name": "expires", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": { "verification_tokens_identifier_token_pk": { "columns": [ "identifier", "token" ], "name": "verification_tokens_identifier_token_pk" } }, "uniqueConstraints": {}, "checkConstraints": {} } }, "views": {}, "enums": {}, "_meta": { "schemas": {}, "tables": {}, "columns": {} }, "internal": { "indexes": {} } }