diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20160919144305_add_type_to_labels.rb | 7 | ||||
-rw-r--r-- | db/migrate/20160920191518_set_project_label_type_on_labels.rb | 17 |
2 files changed, 6 insertions, 18 deletions
diff --git a/db/migrate/20160919144305_add_type_to_labels.rb b/db/migrate/20160919144305_add_type_to_labels.rb index 43aac7846d3..66172bda6ff 100644 --- a/db/migrate/20160919144305_add_type_to_labels.rb +++ b/db/migrate/20160919144305_add_type_to_labels.rb @@ -1,9 +1,14 @@ class AddTypeToLabels < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers - DOWNTIME = false + DOWNTIME = true + DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.' 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 diff --git a/db/migrate/20160920191518_set_project_label_type_on_labels.rb b/db/migrate/20160920191518_set_project_label_type_on_labels.rb deleted file mode 100644 index af47d0320e2..00000000000 --- a/db/migrate/20160920191518_set_project_label_type_on_labels.rb +++ /dev/null @@ -1,17 +0,0 @@ -class SetProjectLabelTypeOnLabels < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def up - update_column_in_batches(:labels, :type, 'ProjectLabel') do |table, query| - query.where(table[:project_id].not_eq(nil)) - end - end - - def down - update_column_in_batches(:labels, :type, nil) do |table, query| - query.where(table[:project_id].not_eq(nil)) - end - end -end |