Sha256: d8cc513d6503eaa567a4a5b7f001890c041c5321a3bfbb343c800ca6ff3a8415
Contents?: true
Size: 1.02 KB
Versions: 59
Compression:
Stored size: 1.02 KB
Contents
class AddUnlimitedToHostCollection < ActiveRecord::Migration[4.2] class ::Katello::HostCollections < ApplicationRecord 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
59 entries across 59 versions & 1 rubygems