gitlab-org--gitlab-foss/db/migrate/20160309140734_fix_todos.rb

18 lines
350 B
Ruby
Raw Normal View History

# rubocop:disable all
2016-03-09 09:18:13 -05:00
class FixTodos < ActiveRecord::Migration
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