cirandas.net

ref: master

db/migrate/20140318225328_set_target_for_enterprise_activation.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class SetTargetForEnterpriseActivation < ActiveRecord::Migration
  def self.up
    EnterpriseActivation.find_each do |enterprise_activation|
      enterprise_activation.target = enterprise_activation.enterprise
      enterprise_activation.data.delete :enterprise_id
      enterprise_activation.save
    end
  end

  def self.down
    say "this migration can't be reverted"
  end
end