diff --git a/db/migrate/20260724132112_restore_settings_index.rb b/db/migrate/20260724132112_restore_settings_index.rb new file mode 100644 index 0000000000..43025338da --- /dev/null +++ b/db/migrate/20260724132112_restore_settings_index.rb @@ -0,0 +1,16 @@ +class RestoreSettingsIndex < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def up + add_index :settings, + [:target_type, :target_id], + name: "index_settings_on_target_type_and_target_id", + algorithm: :concurrently + end + + def down + remove_index :settings, + name: "index_settings_on_target_type_and_target_id", + algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index da97f82579..aea717efda 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.1].define(version: 2026_02_19_185224) do +ActiveRecord::Schema[7.1].define(version: 2026_07_24_132112) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -549,6 +549,7 @@ t.string "target_type" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false + t.index ["target_type", "target_id"], name: "index_settings_on_target_type_and_target_id" end create_table "stats", id: :serial, force: :cascade do |t|