ref: master
db/migrate/20100730141134_set_owner_environment_to_enterprises_environment.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class SetOwnerEnvironmentToEnterprisesEnvironment < ActiveRecord::Migration def self.up CreateEnterprise.where(status: 3).each do |t| if(Enterprise.find_by(identifier: t.data[:identifier])) update("UPDATE profiles SET environment_id = '%s' WHERE identifier = '%s'" % [Person.find(t.requestor_id).environment.id, t.data[:identifier]]) end end end def self.down say "this migration can't be reverted" end end |