2016-06-09 08:39:16 -04:00
|
|
|
# rubocop:disable all
|
2018-11-13 02:27:31 -05:00
|
|
|
class FixTodos < ActiveRecord::Migration[4.2]
|
2016-03-09 09:18:13 -05:00
|
|
|
def up
|
|
|
|
execute <<-SQL
|
|
|
|
DELETE FROM todos
|
|
|
|
WHERE todos.target_type IN ('Commit', 'ProjectSnippet')
|
|
|
|
OR NOT EXISTS (
|
|
|
|
SELECT *
|
|
|
|
FROM projects
|
|
|
|
WHERE projects.id = todos.project_id
|
|
|
|
)
|
|
|
|
SQL
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|