Sha256: 8f6af6e732228b0ed58347a82fa464c689b8670338da41745e24114e884315b4

Contents?: true

Size: 985 Bytes

Versions: 1

Compression:

Stored size: 985 Bytes

Contents

class AddUnlimitedToActivationKeys < ActiveRecord::Migration
  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

    update "UPDATE katello_activation_keys
            SET unlimited_content_hosts = true, max_content_hosts = null
            WHERE max_content_hosts = -1"

    update "UPDATE katello_activation_keys
            SET unlimited_content_hosts = false
            WHERE max_content_hosts > 0"
  end

  def down
    update "UPDATE katello_activation_keys
            SET max_content_hosts = -1
            WHERE unlimited_content_hosts = true"

    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

1 entries across 1 versions & 1 rubygems

Version Path
katello-2.2.2 db/migrate/20140626204657_add_unlimited_to_activation_keys.rb