Skip to content

Instantly share code, notes, and snippets.

@al3rez
Last active February 2, 2019 05:28
Show Gist options
  • Save al3rez/685e59b71d6b7efcf3cdb6b1abcd8a64 to your computer and use it in GitHub Desktop.
Save al3rez/685e59b71d6b7efcf3cdb6b1abcd8a64 to your computer and use it in GitHub Desktop.
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