diff --git a/db/migrate/20231130031209_add_index_on_conversations_ancestor_status_id.rb b/db/migrate/20231130031209_add_index_on_conversations_ancestor_status_id.rb new file mode 100644 index 0000000000..20d86c6dfa --- /dev/null +++ b/db/migrate/20231130031209_add_index_on_conversations_ancestor_status_id.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIndexOnConversationsAncestorStatusId < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :conversations, :ancestor_status_id, where: 'ancestor_status_id IS NOT NULL', algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 20702a451c..1710998302 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: 2023_11_15_001356) do +ActiveRecord::Schema[7.1].define(version: 2023_11_30_031209) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -477,6 +477,7 @@ ActiveRecord::Schema[7.1].define(version: 2023_11_15_001356) do t.datetime "updated_at", precision: nil, null: false t.string "inbox_url" t.bigint "ancestor_status_id" + t.index ["ancestor_status_id"], name: "index_conversations_on_ancestor_status_id", where: "(ancestor_status_id IS NOT NULL)" t.index ["uri"], name: "index_conversations_on_uri", unique: true, opclass: :text_pattern_ops, where: "(uri IS NOT NULL)" end