debian-mirror-gitlab/db/migrate/20160919144305_add_type_to_labels.rb

18 lines
480 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
# rubocop:disable Migration/UpdateColumnInBatches
2016-11-03 12:29:30 +05:30
class AddTypeToLabels < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = true
DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'
2017-09-10 17:25:29 +05:30
disable_ddl_transaction!
2016-11-03 12:29:30 +05:30
def change
add_column :labels, :type, :string
update_column_in_batches(:labels, :type, 'ProjectLabel') do |table, query|
query.where(table[:project_id].not_eq(nil))
end
end
end