summaryrefslogtreecommitdiff
path: root/db/migrate/20160309140734_fix_todos.rb
blob: 917055f5036c19fe06d844a67d3c0a8da3af54b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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