2012-10-27 19:04:28 +01:00
|
|
|
class AddHelpersColumnsToPullRequest < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
add_column :pull_requests, :from_project_owner_uname, :string
|
|
|
|
add_column :pull_requests, :from_project_name, :string
|
|
|
|
# includes generate error "undefined method `repo' for nil:NilClass"
|
|
|
|
# update not orphan pulls. For other need execute a task project:fix_orphan_pulls
|
2012-11-12 14:59:46 +00:00
|
|
|
PullRequest.joins(:from_project).each do |pull|
|
|
|
|
pull.from_project_name = pull.from_project.name
|
|
|
|
pull.from_project_owner_uname = pull.from_project.owner.uname
|
|
|
|
pull.save
|
|
|
|
end
|
2012-10-27 19:04:28 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_column :pull_requests, :from_project_owner_uname
|
|
|
|
remove_column :pull_requests, :from_project_name
|
|
|
|
end
|
|
|
|
end
|