gitlab-org--gitlab-foss/db/migrate/20160527020117_remove_notif...

15 lines
399 B
Ruby

# rubocop:disable all
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