mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-11 22:24:21 +01:00
20 lines
448 B
Ruby
20 lines
448 B
Ruby
class MigrateSubscriptionToStatisticProfile < ActiveRecord::Migration
|
|
def up
|
|
Subscription.all.each do |s|
|
|
user = User.find(s.user_id)
|
|
s.update_column(
|
|
'statistic_profile_id', user.statistic_profile.id
|
|
)
|
|
end
|
|
end
|
|
|
|
def down
|
|
Subscription.all.each do |s|
|
|
statistic_profile = User.find(s.statistic_profile_id)
|
|
s.update_column(
|
|
'user_id', statistic_profile.user_id
|
|
)
|
|
end
|
|
end
|
|
end
|