debian-mirror-gitlab/db/migrate/20130419190306_allow_merges_for_forks.rb
2016-06-16 23:09:34 +05:30

21 lines
597 B
Ruby

# rubocop:disable all
class AllowMergesForForks < ActiveRecord::Migration
def self.up
add_column :merge_requests, :target_project_id, :integer, :null => true
execute "UPDATE #{table_name} SET target_project_id = project_id"
change_column :merge_requests, :target_project_id, :integer, :null => false
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
private
def table_name
MergeRequest.table_name
end
end