Sha256: 00746f1cc4420706966ca49052b88981d8924ad4c7bf304379564c1cb292a340
Contents?: true
Size: 1.06 KB
Versions: 134
Compression:
Stored size: 1.06 KB
Contents
class AddUnlimitedToActivationKeys < ActiveRecord::Migration[4.2] 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(:unlimited_content_hosts => true, :max_content_hosts => nil) elsif coll.max_content_hosts > 0 coll.update(:unlimited_content_hosts => false) end end end def down Katello::ActivationKeys.all.each do |key| key.update(: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
134 entries across 134 versions & 1 rubygems