2016-06-16 23:09:34 +05:30
|
|
|
# rubocop:disable all
|
2019-02-15 15:39:39 +05:30
|
|
|
class FixTodos < ActiveRecord::Migration[4.2]
|
2016-04-02 18:10:28 +05:30
|
|
|
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
|