debian-mirror-gitlab/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb
2019-02-15 15:39:39 +05:30

13 lines
382 B
Ruby

class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration[4.2]
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