From 780426db31eba17b3247c720c9ea27da3bbbd0ca 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 18:38:48 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=E9=99=90=E5=AE=9A=E6=8A=95=E7=A8=BF?= =?UTF-8?q?=E6=96=B0=E8=A6=8F=E8=BF=BD=E5=8A=A0=E6=99=82=E3=81=AE=E8=B2=A0?= =?UTF-8?q?=E8=8D=B7=20(#321)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...231130083634_add_index_on_statuses_conversation_id.rb | 9 +++++++++ db/schema.rb | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20231130083634_add_index_on_statuses_conversation_id.rb diff --git a/db/migrate/20231130083634_add_index_on_statuses_conversation_id.rb b/db/migrate/20231130083634_add_index_on_statuses_conversation_id.rb new file mode 100644 index 0000000000..171be04fd7 --- /dev/null +++ b/db/migrate/20231130083634_add_index_on_statuses_conversation_id.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIndexOnStatusesConversationId < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :statuses, :conversation_id, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 1710998302..10479d4f27 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_30_031209) do +ActiveRecord::Schema[7.1].define(version: 2023_11_30_083634) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1238,6 +1238,7 @@ ActiveRecord::Schema[7.1].define(version: 2023_11_30_031209) do t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)" t.index ["account_id", "reblog_of_id", "deleted_at", "searchability"], name: "index_statuses_for_get_following_accounts_to_search", where: "((deleted_at IS NULL) AND (reblog_of_id IS NULL) AND (searchability = ANY (ARRAY[0, 10, 1])))" t.index ["account_id"], name: "index_statuses_on_account_id" + t.index ["conversation_id"], name: "index_statuses_on_conversation_id" t.index ["deleted_at"], name: "index_statuses_on_deleted_at", where: "(deleted_at IS NOT NULL)" t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))" t.index ["id", "account_id"], name: "index_statuses_public_20200119", order: { id: :desc }, where: "((deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"