Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-02-03 11:21:41 +0300
committerJames Lopez <james@jameslopez.es>2018-02-03 11:28:13 +0300
commitb1f4dffda0bacd7bab1d79773c077568583f19e6 (patch)
tree1fb7194d4eea10aeeaace0f05f124ba671359e8e /db
parenta306c1957ecae2a5c5bf4812b7c31e7ac488e78a (diff)
add migration before 20171207150343
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb b/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
new file mode 100644
index 00000000000..0886a655aa2
--- /dev/null
+++ b/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
@@ -0,0 +1,19 @@
+# Copy of 20180202111106 - this one should run before 20171207150343 to fix issues related to
+# the removal of groups with labels.
+
+class RemoveProjectLabelsGroupIdCopy < 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