add index

This commit is contained in:
Pete Matsyburka committed 2026-11-01 12:38:59 +02:00
1 parent 9bfa6f7f4a
commit 7ee648dacb
3 files changed
+11 -2

No files matched your search

+2 -1
View File
@@ -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 }
@@ -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
+2 -1
View File
@@ -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