summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-02 12:02:31 +0100
committerStan Hu <stanhu@gmail.com>2018-02-02 06:35:40 -0800
commitb807a7d731f390bce7cbe165b78200f4a0acc073 (patch)
treed1dbd7d37c80f988354bb026aea1261d905743c5
parentb7d8098b3abcc0e13b55da0e78cca8464d921f42 (diff)
downloadgitlab-ce-b807a7d731f390bce7cbe165b78200f4a0acc073.tar.gz
add migration
-rw-r--r--db/post_migrate/20180202111106_remove_project_labels_group_id.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20180202111106_remove_project_labels_group_id.rb b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb
new file mode 100644
index 00000000000..db7fd0d167d
--- /dev/null
+++ b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb
@@ -0,0 +1,19 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class RemoveProjectLabelsGroupId < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ update_column_in_batches(:labels, :group_id, nil) do |table, query|
+ query.where(table[:type].eq('ProjectLabel').and(table[:group_id].not_eq(nil)))
+ end
+ end
+
+ def down
+ end
+end