gitlab-org--gitlab-foss/db/post_migrate/20171207150300_remove_proje...

22 lines
603 B
Ruby
Raw Normal View History

2018-02-03 08:21:41 +00:00
# Copy of 20180202111106 - this one should run before 20171207150343 to fix issues related to
# the removal of groups with labels.
class RemoveProjectLabelsGroupIdCopy < ActiveRecord::Migration[4.2]
2018-02-03 08:21:41 +00:00
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
2018-02-03 09:42:44 +00:00
# rubocop:disable Migration/UpdateColumnInBatches
2018-02-03 08:21:41 +00:00
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
2018-02-03 09:42:44 +00:00
# rubocop:enable Migration/UpdateColumnInBatches
2018-02-03 08:21:41 +00:00
end
def down
end
end