Sha256: 886774919e751e38aa362254108ee5f3dd0fa42ffbb85a8ef6d70b63882cb7a6
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
class RenameEnvironments < ActiveRecord::Migration RENAMES = { "dev" => "staging", "master" => "production", "PRI" => "Staging", "Production" => "Production" } class Environment < ActiveRecord::Base; end def up Environment.all.each do |environment| environment.slug = RENAMES[environment.slug] || (raise "Didn't anticipate an environment with the slug \"#{environment.slug}\"") environment.name = RENAMES[environment.name] || (raise "Didn't anticipate an environment with the name \"#{environment.name}\"") environment.save! end end def down Environment.all.each do |environment| environment.slug = RENAMES.key(environment.slug) || (raise "Didn't anticipate an environment with the slug \"#{environment.slug}\"") environment.name = RENAMES.key(environment.name) || (raise "Didn't anticipate an environment with the name \"#{environment.name}\"") environment.save! end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.5.0.beta1 | db/migrate/20121224212623_rename_environments.rb |