Sha256: 524606bb02913f18164c8d04bbc6fecb1f0160e3c1f9e6292f0eaa0f174a5b7d
Contents?: true
Size: 1.09 KB
Versions: 7
Compression:
Stored size: 1.09 KB
Contents
class AddUnlimitedToActivationKeys < ActiveRecord::Migration class ::Katello::ActivationKeys < ApplicationRecord end def up add_column :katello_activation_keys, :unlimited_content_hosts, :boolean, :default => true rename_column :katello_activation_keys, :usage_limit, :max_content_hosts change_column_default :katello_activation_keys, :max_content_hosts, nil Katello::ActivationKeys.reset_column_information Katello::ActivationKeys.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::ActivationKeys.all.each do |key| key.update_attributes(:max_content_hosts => -1) if key.unlimited_content_hosts end remove_column :katello_activation_keys, :unlimited_content_hosts rename_column :katello_activation_keys, :max_content_hosts, :usage_limit change_column_default :katello_activation_keys, :usage_limit, -1 end end
Version data entries
7 entries across 7 versions & 1 rubygems