BigW Consortium Gitlab

20160309140734_fix_todos.rb 328 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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