From 5ebad3be0a8937f31c8e2ccdf132d0a8a1d5ec9c Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 27 May 2022 08:22:23 +1000 Subject: [PATCH] FIX: Further refine duplicate bookmark delete query (#16931) In f00e28206727da7a80d7a415cf825e746fd8d186 we added this DELETE query to delete duplicate for_topic bookmarks, we just need this further refinement to the WHERE clause to avoid deleting post bookmarks. --- ...512011522_backfill_polymorphic_bookmarks_and_make_default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20220512011522_backfill_polymorphic_bookmarks_and_make_default.rb b/db/migrate/20220512011522_backfill_polymorphic_bookmarks_and_make_default.rb index d3f5806c4a6..a1c830e23e9 100644 --- a/db/migrate/20220512011522_backfill_polymorphic_bookmarks_and_make_default.rb +++ b/db/migrate/20220512011522_backfill_polymorphic_bookmarks_and_make_default.rb @@ -22,7 +22,7 @@ class BackfillPolymorphicBookmarksAndMakeDefault < ActiveRecord::Migration[7.0] INNER JOIN posts ON bookmarks.post_id = posts.id WHERE bookmarks.for_topic GROUP BY (bookmarks.user_id, posts.topic_id) - ) + ) AND bookmarks.for_topic SQL DB.exec(<<~SQL)