Skip to content
Extraits de code Groupes Projets
Valider 03e8aa31 rédigé par zhitomirskiyi's avatar zhitomirskiyi
Parcourir les fichiers

fixed notifications migration

parent ac50a011
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -38,7 +38,8 @@ class NotificationMultiplePeople < ActiveRecord::Migration ...@@ -38,7 +38,8 @@ class NotificationMultiplePeople < ActiveRecord::Migration
"WHERE n1.keep_id != n2.id " + "WHERE n1.keep_id != n2.id " +
"AND n1.target_type = n2.target_type AND n1.target_id = n2.target_id " + "AND n1.target_type = n2.target_type AND n1.target_id = n2.target_id " +
"AND n1.recipient_id = n2.recipient_id AND n1.action = n2.action " + "AND n1.recipient_id = n2.recipient_id AND n1.action = n2.action " +
"AND (n1.action = 'comment_on_post' OR n1.action = 'also_commented'))" "AND (n1.action = 'comment_on_post' OR n1.action = 'also_commented') "+
"GROUP BY n2.actor_id , n2.target_type , n2.target_id , n2.recipient_id , n2.action)"
#have the notifications actors reference the notifications that need to be kept #have the notifications actors reference the notifications that need to be kept
execute "UPDATE notification_actors, keep_delete "+ execute "UPDATE notification_actors, keep_delete "+
...@@ -48,7 +49,11 @@ class NotificationMultiplePeople < ActiveRecord::Migration ...@@ -48,7 +49,11 @@ class NotificationMultiplePeople < ActiveRecord::Migration
#delete all the notifications that need to be deleted #delete all the notifications that need to be deleted
execute "DELETE notifications.* " + execute "DELETE notifications.* " +
"FROM notifications, keep_delete " + "FROM notifications, keep_delete " +
"WHERE notifications.id = keep_delete.delete_id " "WHERE notifications.id != keep_delete.keep_id AND "+
"notifications.target_type = keep_delete.target_type AND "+
"notifications.target_id = keep_delete.target_id AND "+
"notifications.recipient_id = keep_delete.recipient_id AND "+
"notifications.action = keep_delete.action"
remove_column :notifications, :actor_id remove_column :notifications, :actor_id
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter