From 713032567f1721063685f44ca61c4892787b392c Mon Sep 17 00:00:00 2001 From: Marta Nicholson Date: Tue, 11 Aug 2026 10:59:11 +0100 Subject: [PATCH 1/3] migration file for index Settings table. This was to revert 20180713161007_remove_settings_indices.rb --- .../20260724132112_restore_settings_index.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 db/migrate/20260724132112_restore_settings_index.rb diff --git a/db/migrate/20260724132112_restore_settings_index.rb b/db/migrate/20260724132112_restore_settings_index.rb new file mode 100644 index 0000000000..d577551c99 --- /dev/null +++ b/db/migrate/20260724132112_restore_settings_index.rb @@ -0,0 +1,16 @@ +class RestoreSettingsIndex < ActiveRecord::Migration[6.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 From 66d021e155166a197774325fe2dcdaf4c589b95d Mon Sep 17 00:00:00 2001 From: Marta Nicholson Date: Tue, 11 Aug 2026 11:13:15 +0100 Subject: [PATCH 2/3] Update 20260724132112_restore_settings_index.rb Change the Migration rails version --- db/migrate/20260724132112_restore_settings_index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20260724132112_restore_settings_index.rb b/db/migrate/20260724132112_restore_settings_index.rb index d577551c99..43025338da 100644 --- a/db/migrate/20260724132112_restore_settings_index.rb +++ b/db/migrate/20260724132112_restore_settings_index.rb @@ -1,4 +1,4 @@ -class RestoreSettingsIndex < ActiveRecord::Migration[6.1] +class RestoreSettingsIndex < ActiveRecord::Migration[7.1] disable_ddl_transaction! def up From 9b280ab2161eef64999db3d9f8889c0f347a4e51 Mon Sep 17 00:00:00 2001 From: Marta Nicholson Date: Tue, 11 Aug 2026 16:43:44 +0100 Subject: [PATCH 3/3] commit the schema.rb --- db/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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|