2017-05-23 12:57:03 +00:00
|
|
|
# rubocop:disable Migration/UpdateColumnInBatches
|
2018-11-13 07:27:31 +00:00
|
|
|
class AddTypeToLabels < ActiveRecord::Migration[4.2]
|
2016-09-19 15:04:38 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
2016-10-03 21:43:39 +00:00
|
|
|
DOWNTIME = true
|
|
|
|
DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'
|
2016-09-19 15:04:38 +00:00
|
|
|
|
2017-06-21 12:35:06 +00:00
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2016-09-19 15:04:38 +00:00
|
|
|
def change
|
|
|
|
add_column :labels, :type, :string
|
2016-10-03 21:43:39 +00:00
|
|
|
|
|
|
|
update_column_in_batches(:labels, :type, 'ProjectLabel') do |table, query|
|
|
|
|
query.where(table[:project_id].not_eq(nil))
|
|
|
|
end
|
2016-09-19 15:04:38 +00:00
|
|
|
end
|
|
|
|
end
|