mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
20 lines
454 B
Ruby
20 lines
454 B
Ruby
|
class MigrateProjetToStatisticProfile < ActiveRecord::Migration
|
||
|
def up
|
||
|
Project.all.each do |p|
|
||
|
author = User.find(p.author_id)
|
||
|
p.update_column(
|
||
|
'author_statistic_profile_id', author.statistic_profile.id
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
Project.all.each do |p|
|
||
|
statistic_profile = User.find(p.author_statistic_profile_id)
|
||
|
p.update_column(
|
||
|
'author_id', statistic_profile.user_id
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|