From 5ef7e4c53018803731aceb2303e8369707d78f4a Mon Sep 17 00:00:00 2001 From: Emma Lejeck Date: Sat, 23 Nov 2024 23:12:35 -0800 Subject: [PATCH] Index UGC on held_reason --- db/migrate/20241124071050_index_held_reasons.rb | 9 +++++++++ db/schema.rb | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 db/migrate/20241124071050_index_held_reasons.rb diff --git a/db/migrate/20241124071050_index_held_reasons.rb b/db/migrate/20241124071050_index_held_reasons.rb new file mode 100644 index 000000000..64a1ca6c0 --- /dev/null +++ b/db/migrate/20241124071050_index_held_reasons.rb @@ -0,0 +1,9 @@ +class IndexHeldReasons < ActiveRecord::Migration[6.1] + disable_ddl_transaction! + + def change + add_index :posts, :held_reason, algorithm: :concurrently + add_index :comments, :held_reason, algorithm: :concurrently + add_index :media_reactions, :held_reason, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 6e40dea54..29a2343b0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -289,6 +289,7 @@ t.integer "held_reason" t.index ["ao_id"], name: "index_comments_on_ao_id", unique: true t.index ["deleted_at"], name: "index_comments_on_deleted_at" + t.index ["held_reason"], name: "index_comments_on_held_reason" t.index ["parent_id"], name: "index_comments_on_parent_id" t.index ["post_id"], name: "index_comments_on_post_id" t.index ["user_id"], name: "index_comments_on_user_id" @@ -1032,6 +1033,7 @@ t.index ["anime_id"], name: "index_media_reactions_on_anime_id" t.index ["deleted_at"], name: "index_media_reactions_on_deleted_at" t.index ["drama_id"], name: "index_media_reactions_on_drama_id" + t.index ["held_reason"], name: "index_media_reactions_on_held_reason" t.index ["library_entry_id"], name: "index_media_reactions_on_library_entry_id" t.index ["manga_id"], name: "index_media_reactions_on_manga_id" t.index ["media_type", "media_id", "user_id"], name: "index_media_reactions_on_media_type_and_media_id_and_user_id", unique: true, where: "(deleted_at IS NULL)" @@ -1244,6 +1246,7 @@ t.index ["ao_id"], name: "index_posts_on_ao_id", unique: true t.index ["community_recommendation_id"], name: "index_posts_on_community_recommendation_id" t.index ["deleted_at"], name: "index_posts_on_deleted_at" + t.index ["held_reason"], name: "index_posts_on_held_reason" t.index ["locked_by_id"], name: "index_posts_on_locked_by_id" t.index ["media_type", "media_id"], name: "posts_media_type_media_id_idx" t.index ["target_group_id"], name: "posts_target_group_id_idx"