From eb7cf381baeea4e9d6d300623f4352b3521569d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Thu, 30 Nov 2023 12:55:50 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20`ancestor=5Fstatus=5Fid`=E6=A4=9C?= =?UTF-8?q?=E7=B4=A2=E3=81=AB=E3=82=88=E3=82=8BDB=E8=B2=A0=E8=8D=B7=20(#31?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1209_add_index_on_conversations_ancestor_status_id.rb | 9 +++++++++ db/schema.rb | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20231130031209_add_index_on_conversations_ancestor_status_id.rb 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