mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 09:21:11 +00:00
Change indexes on quotes to efficiently list quotes of a given account or quoted status (#35819)
This commit is contained in:
parent
421dbf9a7f
commit
736751e5de
13
db/migrate/20250819100545_update_quote_index.rb
Normal file
13
db/migrate/20250819100545_update_quote_index.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class UpdateQuoteIndex < ActiveRecord::Migration[8.0]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_index :quotes, [:account_id, :quoted_account_id, :id], algorithm: :concurrently
|
||||||
|
remove_index :quotes, [:account_id, :quoted_account_id]
|
||||||
|
|
||||||
|
add_index :quotes, [:quoted_status_id, :id], algorithm: :concurrently
|
||||||
|
remove_index :quotes, [:quoted_status_id]
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2025_08_05_075010) do
|
ActiveRecord::Schema[8.0].define(version: 2025_08_19_100545) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
|
@ -926,11 +926,11 @@ ActiveRecord::Schema[8.0].define(version: 2025_08_05_075010) do
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.boolean "legacy", default: false, null: false
|
t.boolean "legacy", default: false, null: false
|
||||||
t.index ["account_id", "quoted_account_id"], name: "index_quotes_on_account_id_and_quoted_account_id"
|
t.index ["account_id", "quoted_account_id", "id"], name: "index_quotes_on_account_id_and_quoted_account_id_and_id"
|
||||||
t.index ["activity_uri"], name: "index_quotes_on_activity_uri", unique: true, where: "(activity_uri IS NOT NULL)"
|
t.index ["activity_uri"], name: "index_quotes_on_activity_uri", unique: true, where: "(activity_uri IS NOT NULL)"
|
||||||
t.index ["approval_uri"], name: "index_quotes_on_approval_uri", where: "(approval_uri IS NOT NULL)"
|
t.index ["approval_uri"], name: "index_quotes_on_approval_uri", where: "(approval_uri IS NOT NULL)"
|
||||||
t.index ["quoted_account_id"], name: "index_quotes_on_quoted_account_id"
|
t.index ["quoted_account_id"], name: "index_quotes_on_quoted_account_id"
|
||||||
t.index ["quoted_status_id"], name: "index_quotes_on_quoted_status_id"
|
t.index ["quoted_status_id", "id"], name: "index_quotes_on_quoted_status_id_and_id"
|
||||||
t.index ["status_id"], name: "index_quotes_on_status_id", unique: true
|
t.index ["status_id"], name: "index_quotes_on_status_id", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user