The personal finance app for everyone
Update database schema: increment version to 2025_07_02_173231, modify virtual column definition for classification, and add new indexes for entries and exchange rates.
Josh Pigford8d0c1c5a5697
diff --git a/db/migrate/20250702173231_fix_mobile_devices_unique_constraint.rb b/db/migrate/20250702173231_fix_mobile_devices_unique_constraint.rbnew file mode 100644index 00000000..f45a6484--- /dev/null+++ b/db/migrate/20250702173231_fix_mobile_devices_unique_constraint.rb@@ -0,0 +1,9 @@+class FixMobileDevicesUniqueConstraint < ActiveRecord::Migration[7.2]+ def change+ # Remove the old unique index on device_id only+ remove_index :mobile_devices, :device_id, if_exists: true++ # The composite unique index on user_id and device_id already exists+ # This allows the same device_id to be used by different users+ end+end\ No newline at end of filediff --git a/db/schema.rb b/db/schema.rbindex f1bc9daf..2a9b0ad6 100644--- a/db/schema.rb+++ b/db/schema.rb@@ -10,7 +10,7 @@## It's strongly recommended that you check this file into your version control system.-ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) do+ActiveRecord::Schema[7.2].define(version: 2025_07_02_173231) do# These are extensions that must be enabled in order to support this databaseenable_extension "pgcrypto"enable_extension "plpgsql"@@ -29,7 +29,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) dot.uuid "accountable_id"t.decimal "balance", precision: 19, scale: 4t.string "currency"- t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY ((ARRAY['Loan'::character varying, 'CreditCard'::character varying, 'OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true+ t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Loan'::character varying)::text, ('CreditCard'::character varying)::text, ('OtherLiability'::character varying)::text])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: truet.uuid "import_id"t.uuid "plaid_account_id"t.decimal "cash_balance", precision: 19, scale: 4, default: "0.0"@@ -215,7 +215,12 @@ ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) dot.boolean "excluded", default: falset.string "plaid_id"t.jsonb "locked_attributes", default: {}+ t.index ["account_id", "date"], name: "index_entries_on_account_id_and_date"t.index ["account_id"], name: "index_entries_on_account_id"+ t.index ["amount"], name: "index_entries_on_amount"+ t.index ["date"], name: "index_entries_on_date"+ t.index ["entryable_id", "entryable_type"], name: "index_entries_on_entryable"+ t.index ["excluded"], name: "index_entries_on_excluded"t.index ["import_id"], name: "index_entries_on_import_id"end@@ -226,6 +231,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) dot.date "date", null: falset.datetime "created_at", null: falset.datetime "updated_at", null: false+ t.index ["date", "from_currency", "to_currency"], name: "index_exchange_rates_on_date_and_currencies"t.index ["from_currency", "to_currency", "date"], name: "index_exchange_rates_on_base_converted_date_unique", unique: truet.index ["from_currency"], name: "index_exchange_rates_on_from_currency"t.index ["to_currency"], name: "index_exchange_rates_on_to_currency"@@ -435,7 +441,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) dot.datetime "created_at", null: falset.datetime "updated_at", null: falset.integer "oauth_application_id"- t.index ["device_id"], name: "index_mobile_devices_on_device_id", unique: truet.index ["oauth_application_id"], name: "index_mobile_devices_on_oauth_application_id"t.index ["user_id", "device_id"], name: "index_mobile_devices_on_user_id_and_device_id", unique: truet.index ["user_id"], name: "index_mobile_devices_on_user_id"@@ -684,6 +689,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_07_01_161640) dot.datetime "created_at", null: falset.datetime "updated_at", null: falset.index ["tag_id"], name: "index_taggings_on_tag_id"+ t.index ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_type"t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable"end