diff options
author | Stan Hu <stanhu@gmail.com> | 2018-02-03 13:30:43 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-02-03 13:30:43 +0000 |
commit | 91d2f92b1a09aa96e464962788cda57485c9a22f (patch) | |
tree | 883856ecaa327acd2d93a44fb68aeced786005e0 | |
parent | 28f978efc1643e3a5d15d913d9b3cb6a5d388fef (diff) | |
parent | 63aa43de0ae274397ef150bf88e7f6b6be89b1d0 (diff) | |
download | gitlab-ce-91d2f92b1a09aa96e464962788cda57485c9a22f.tar.gz |
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
-rw-r--r-- | db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb | 21 |
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 |