diff options
Diffstat (limited to 'db/migrate/20160603180330_remove_duplicated_notification_settings.rb')
-rw-r--r-- | db/migrate/20160603180330_remove_duplicated_notification_settings.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb new file mode 100644 index 00000000000..c2fcac4c53d --- /dev/null +++ b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb @@ -0,0 +1,7 @@ +class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration + def up + execute <<-SQL + DELETE FROM notification_settings WHERE id NOT IN ( SELECT min_id from (SELECT MIN(id) as min_id FROM notification_settings GROUP BY user_id, source_type, source_id) as dups ) + SQL + end +end |