From 10fec60f1ab37bce5caa697ad0dbbe625f7a9a56 Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 22 Oct 2023 17:27:17 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20`quote=5Fof=5Fid`=E3=81=AE=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=87=E3=83=83=E3=82=AF=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20231022074913_add_statuses_quote_index.rb | 13 +++++++++++++ db/schema.rb | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 db/post_migrate/20231022074913_add_statuses_quote_index.rb diff --git a/db/post_migrate/20231022074913_add_statuses_quote_index.rb b/db/post_migrate/20231022074913_add_statuses_quote_index.rb new file mode 100644 index 00000000000000..98025700fcb40e --- /dev/null +++ b/db/post_migrate/20231022074913_add_statuses_quote_index.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class AddStatusesQuoteIndex < ActiveRecord::Migration[7.0] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def change + safety_assured { add_index :statuses, [:quote_of_id, :account_id], unique: false } + end +end diff --git a/db/schema.rb b/db/schema.rb index af31ed869b33a9..071f29c2e0d91c 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.0].define(version: 2023_10_21_005339) do +ActiveRecord::Schema[7.0].define(version: 2023_10_22_074913) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1228,6 +1228,7 @@ 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)))" t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id", where: "(in_reply_to_account_id IS NOT NULL)" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", where: "(in_reply_to_id IS NOT NULL)" + t.index ["quote_of_id", "account_id"], name: "index_statuses_on_quote_of_id_and_account_id" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id" t.index ["uri"], name: "index_statuses_on_uri", unique: true, opclass: :text_pattern_ops, where: "(uri IS NOT NULL)" end