Commit e87149a1 authored by Stan Hu's avatar Stan Hu

Merge branch 'remove-dangling-notification-settings' into 'master'

Remove project notification settings associated with deleted projects

On GitLab.com, there are 1560 project notification settings with no valid project all created on 2016-04-15 10:38:53 for some reason. This migration should purge
those entries.
    
b8f38437 should prevent this issue from occurring in the first place.
    
Closes gitlab-com/support-forum#678


See merge request !4311
parents 5011eeb1 4da07781
...@@ -4,6 +4,7 @@ v 8.9.0 (unreleased) ...@@ -4,6 +4,7 @@ v 8.9.0 (unreleased)
- Allow enabling wiki page events from Webhook management UI - Allow enabling wiki page events from Webhook management UI
- Allow forking projects with restricted visibility level - Allow forking projects with restricted visibility level
- Improve note validation to prevent errors when creating invalid note via API - Improve note validation to prevent errors when creating invalid note via API
- Remove project notification settings associated with deleted projects
- Redesign navigation for project pages - Redesign navigation for project pages
- Fix groups API to list only user's accessible projects - Fix groups API to list only user's accessible projects
- Redesign account and email confirmation emails - Redesign account and email confirmation emails
......
class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration
def up
execute <<-SQL
DELETE FROM notification_settings
WHERE notification_settings.source_type = 'Project'
AND NOT EXISTS (
SELECT *
FROM projects
WHERE projects.id = notification_settings.source_id
)
SQL
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment