summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-10 09:45:38 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-10 09:45:38 +0100
commit570f428b89fad526e6f7c9c4afd16a8ced83369a (patch)
tree1fa3f4acced8b921c4105fde193128ecce3fc733 /db/migrate
parent3eb7ea49feaf9341b2eec6eb0c58ae2f0aa37864 (diff)
parent491ac7ce4b79c901e23799d2062f9f013f08c6c3 (diff)
downloadgitlab-ce-redis-config-parser.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into redis-config-parserredis-config-parser
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20160309140734_fix_todos.rb16
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