Created
February 2, 2019 11:00
-
-
Save al3rez/81e48f71465ea8d797da80825e2d7f24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DropSubscriptionRewards < ActiveRecord::Migration[5.2] | |
def up | |
subscription_rewards = SubscriptionReward.all | |
subscription_rewards.each do |subscription_reward| | |
MissionReward.create!( | |
subscription_mission_id: subscription_reward.subscription_mission_id, | |
reward_id: subscription_reward.reward_id, | |
starts_at: subscription_reward.created_at, | |
ends_at: subscription_reward.expires_at, | |
redeemed_at: subscription_reward.redeemed_at | |
) | |
end | |
drop_table :subscription_rewards | |
end | |
def down | |
raise ActiveRecord::IrreversibleMigration | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment