]> cat aescling's git repositories - mastodon.git/commitdiff
Fix regression in custom emoji migration (#9742)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 7 Jan 2019 08:47:00 +0000 (09:47 +0100)
committerGitHub <noreply@github.com>
Mon, 7 Jan 2019 08:47:00 +0000 (09:47 +0100)
Fix #9741

db/migrate/20181207011115_downcase_custom_emoji_domains.rb

index 1fce2cb37981315f94550d22b9cad0a71679ef3b..65f1fc8d938c835fd8b6742ac1918914f6059dbd 100644 (file)
@@ -2,7 +2,7 @@ class DowncaseCustomEmojiDomains < ActiveRecord::Migration[5.2]
   disable_ddl_transaction!
 
   def up
-    duplicates = CustomEmoji.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM custom_emojis GROUP BY lower(domain) HAVING count(*) > 1').to_hash
+    duplicates = CustomEmoji.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM custom_emojis GROUP BY shortcode, lower(domain) HAVING count(*) > 1').to_hash
 
     duplicates.each do |row|
       CustomEmoji.where(id: row['ids'].split(',')[0...-1]).destroy_all