diff options
Diffstat (limited to 'db/migrate/20160309140734_fix_todos.rb')
-rw-r--r-- | db/migrate/20160309140734_fix_todos.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20160309140734_fix_todos.rb b/db/migrate/20160309140734_fix_todos.rb new file mode 100644 index 00000000000..ebe0fc82305 --- /dev/null +++ b/db/migrate/20160309140734_fix_todos.rb @@ -0,0 +1,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 |