2018-11-13 07:27:31 +00:00
|
|
|
class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration[4.2]
|
2016-05-27 02:19:11 +00:00
|
|
|
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
|