1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/db/migrate/20190604065348_migrate_subscription_to_statistic_profile.rb

22 lines
483 B
Ruby
Raw Normal View History

# frozen_string_literal:true
class MigrateSubscriptionToStatisticProfile < ActiveRecord::Migration[4.2]
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