BigW Consortium Gitlab

20130220125544_convert_merge_status_in_merge_request.rb 767 Bytes
Newer Older
1
# rubocop:disable all
2 3
class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration
  def up
4 5 6
    execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1"
    execute "UPDATE #{table_name} SET new_merge_status = 'can_be_merged' WHERE merge_status = 2"
    execute "UPDATE #{table_name} SET new_merge_status = 'cannot_be_merged' WHERE merge_status = 3"
7 8 9
  end

  def down
10 11 12 13 14 15 16 17 18
    execute "UPDATE #{table_name} SET merge_status = 1 WHERE new_merge_status = 'unchecked'"
    execute "UPDATE #{table_name} SET merge_status = 2 WHERE new_merge_status = 'can_be_merged'"
    execute "UPDATE #{table_name} SET merge_status = 3 WHERE new_merge_status = 'cannot_be_merged'"
  end

  private

  def table_name
    MergeRequest.table_name
19 20
  end
end