From 0345323100c32d8945607d67def430057d82a9e5 Mon Sep 17 00:00:00 2001 From: noellabo Date: Sun, 1 Mar 2020 19:31:59 +0900 Subject: [PATCH] Add index to statuses quote_id --- .../20200301102028_add_index_to_statuses_quote_id.rb | 9 +++++++++ db/schema.rb | 1 + 2 files changed, 10 insertions(+) create mode 100644 db/migrate/20200301102028_add_index_to_statuses_quote_id.rb diff --git a/db/migrate/20200301102028_add_index_to_statuses_quote_id.rb b/db/migrate/20200301102028_add_index_to_statuses_quote_id.rb new file mode 100644 index 000000000..45293db98 --- /dev/null +++ b/db/migrate/20200301102028_add_index_to_statuses_quote_id.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIndexToStatusesQuoteId < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :statuses, :quote_id, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 0f864cce4..5038950fc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -849,6 +849,7 @@ ActiveRecord::Schema.define(version: 2021_08_08_071221) do 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" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" + t.index ["quote_id"], name: "index_statuses_on_quote_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 end