diff --git a/app/models/account.rb b/app/models/account.rb index 3415712e3..309153ced 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -15,7 +15,8 @@ # # Indexes # -# index_accounts_on_uuid (uuid) UNIQUE +# index_accounts_on_created_at (created_at) +# index_accounts_on_uuid (uuid) UNIQUE # class Account < ApplicationRecord attribute :uuid, :string, default: -> { SecureRandom.uuid } diff --git a/db/migrate/20261101120000_add_accounts_created_at_index.rb b/db/migrate/20261101120000_add_accounts_created_at_index.rb new file mode 100644 index 000000000..74daeeaa1 --- /dev/null +++ b/db/migrate/20261101120000_add_accounts_created_at_index.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddAccountsCreatedAtIndex < ActiveRecord::Migration[8.1] + def change + add_index :accounts, :created_at, if_not_exists: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6cad2cf49..431f21537 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[8.1].define(version: 2026_10_25_120002) do +ActiveRecord::Schema[8.1].define(version: 2026_11_01_120000) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_catalog.plpgsql" @@ -62,6 +62,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_10_25_120002) do t.string "timezone", null: false t.datetime "updated_at", null: false t.string "uuid", null: false + t.index ["created_at"], name: "index_accounts_on_created_at" t.index ["uuid"], name: "index_accounts_on_uuid", unique: true end