BigW Consortium Gitlab

20130419190306_allow_merges_for_forks.rb 597 Bytes
Newer Older
1
# rubocop:disable all
2 3
class AllowMergesForForks < ActiveRecord::Migration
  def self.up
4
    add_column :merge_requests, :target_project_id, :integer, :null => true
5
    execute "UPDATE #{table_name} SET target_project_id = project_id"
6
    change_column :merge_requests, :target_project_id, :integer, :null => false
7 8 9 10 11 12 13
    rename_column :merge_requests, :project_id, :source_project_id
  end

  def self.down
    remove_column :merge_requests, :target_project_id
    rename_column :merge_requests, :source_project_id,:project_id
  end
14 15 16 17 18 19

  private

  def table_name
    MergeRequest.table_name
  end
20
end