diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/puppet/rails/database/003_add_environment_to_host.rb | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -1,4 +1,6 @@ 0.24.8 + Fixed #1959 - Added column protection for environment schema migration + Fixing #1869 - autoloaded files should never leak exceptions Fixing #1543 - Nagios parse errors no longer kill Puppet diff --git a/lib/puppet/rails/database/003_add_environment_to_host.rb b/lib/puppet/rails/database/003_add_environment_to_host.rb index 4593a06f7..3ed10e946 100644 --- a/lib/puppet/rails/database/003_add_environment_to_host.rb +++ b/lib/puppet/rails/database/003_add_environment_to_host.rb @@ -1,9 +1,13 @@ class AddEnvironmentToHost < ActiveRecord::Migration def self.up - add_column :hosts, :environment, :string + unless ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment") + add_column :hosts, :environment, :string + end end def self.down - remove_column :hosts, :environment + if ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment") + remove_column :hosts, :environment + end end end |