Skip to content

Commit

Permalink
pkp/pkp-lib#3412 Clean up notifications on announcement deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Mar 2, 2018
1 parent 1b41242 commit 8fa9168
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbscripts/xml/upgrade/3.1.1_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@
<query driver="postgres7">UPDATE users SET citations = us. groupedGossips FROM (SELECT user_id, string_agg(DISTINCT setting_value, ' ') AS groupedGossips FROM user_settings WHERE setting_name = 'gossip' AND setting_value &lt;&gt; '' GROUP BY user_id) AS us WHERE us.user_id = users.user_id</query>
<query>DELETE FROM user_settings WHERE setting_name="gossip"</query>
</sql>
<sql><!-- pkp/pkp-lib#3412 Clean up notifications left over from deleted announcements -->
<query driver="mysql">DELETE n FROM notifications n LEFT JOIN announcements a ON (n.assoc_id = a.announcement_id) WHERE a.announcement_id IS NULL AND n.assoc_type = 522</query><!-- ASSOC_TYPE_ANNOUNCEMENT -->
<query driver="mysqli">DELETE n FROM notifications n LEFT JOIN announcements a ON (n.assoc_id = a.announcement_id) WHERE a.announcement_id IS NULL AND n.assoc_type = 522</query><!-- ASSOC_TYPE_ANNOUNCEMENT -->
<query driver="postgres7">DELETE FROM notifications USING notifications n LEFT JOIN announcements a ON (n.assoc_id = a.announcement_id) WHERE a.announcement_id IS NULL AND n.assoc_type = 522 AND notifications.notification_id = n.notification_id</query><!-- ASSOC_TYPE_ANNOUNCEMENT -->
</sql>
</data>

0 comments on commit 8fa9168

Please sign in to comment.