mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 21:24:54 +08:00
14 lines
318 B
Ruby
14 lines
318 B
Ruby
|
class AddTeamIdToReports < ActiveRecord::Migration[5.1]
|
||
|
def up
|
||
|
add_reference :reports, :team, index: true
|
||
|
Report.preload(:project).find_each do |report|
|
||
|
team_id = report.project.team_id
|
||
|
report.update_column(:team_id, team_id)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
remove_column :reports, :team
|
||
|
end
|
||
|
end
|