Sha256: 7ca0a2e6044dabec3518bf44bb232dcb49c5f2ca0ea90beb3d8ae21c887f14f9
Contents?: true
Size: 1.01 KB
Versions: 46
Compression:
Stored size: 1.01 KB
Contents
class AddUnlimitedToHostCollection < ActiveRecord::Migration class ::Katello::HostCollections < ActiveRecord::Base end def up add_column :katello_host_collections, :unlimited_content_hosts, :boolean, :default => true change_column :katello_host_collections, :max_content_hosts, :integer, :null => true, :default => nil Katello::HostCollections.reset_column_information Katello::HostCollections.all.each do |coll| if coll.max_content_hosts == -1 coll.update_attributes(:unlimited_content_hosts => true, :max_content_hosts => nil) elsif coll.max_content_hosts > 0 coll.update_attributes(:unlimited_content_hosts => false) end end end def down Katello::HostCollections.all.each do |coll| coll.update_attributes(:max_content_hosts => -1) if coll.unlimited_content_hosts end remove_column :katello_host_collections, :unlimited_content_hosts change_column :katello_host_collections, :max_content_hosts, :integer, :null => false, :default => -1 end end
Version data entries
46 entries across 46 versions & 1 rubygems