From f8cb997b98ba219d110839b4178ee9b469ff944b Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 20:04:50 +0200 Subject: [PATCH] Add index on `target_account_id` to `follow_requests` (#40033) --- ...172525_add_target_account_index_to_follow_requests.rb | 9 +++++++++ db/schema.rb | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb diff --git a/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb b/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb new file mode 100644 index 00000000000..bf22c541343 --- /dev/null +++ b/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddTargetAccountIndexToFollowRequests < ActiveRecord::Migration[8.1] + disable_ddl_transaction! + + def change + add_index :follow_requests, [:target_account_id, :account_id], algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index e4d8d851a86..0d6c703d995 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_08_03_140751) do +ActiveRecord::Schema[8.1].define(version: 2026_08_03_172525) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -632,6 +632,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_03_140751) do t.datetime "updated_at", precision: nil, null: false t.string "uri" t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true + t.index ["target_account_id", "account_id"], name: "index_follow_requests_on_target_account_id_and_account_id" end create_table "follows", force: :cascade do |t|