debian-mirror-gitlab/db/migrate/20160309140734_fix_todos.rb
2019-02-15 15:39:39 +05:30

18 lines
355 B
Ruby

# rubocop:disable all
class FixTodos < ActiveRecord::Migration[4.2]
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