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:
authorStan Hu <stanhu@gmail.com>2018-02-03 16:30:43 +0300
committerRobert Speicher <rspeicher@gmail.com>2018-02-14 23:21:27 +0300
commit9609d1b03508aee363b6a9ad88cdbc414fd25ccc (patch)
treef39984195b257d11d163025363b8e5f359b52a83 /db
parent2008eb9900e2231f2e08f39720ff8c72189e8435 (diff)
Merge branch 'fix-migration-timestamp' into 'master'
Update labels migration timestamp to run earlier than the one that removes namespaces to avoid issues See merge request gitlab-org/gitlab-ce!16907
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb21
1 files changed, 21 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..2f339172eeb
--- /dev/null
+++ b/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
@@ -0,0 +1,21 @@
+# 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
+ # rubocop:disable Migration/UpdateColumnInBatches
+ 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
+ # rubocop:enable Migration/UpdateColumnInBatches
+ end
+
+ def down
+ end
+end