Sha256: 6ddddf8e9274dd5f80b56f69b61faccf8638e75e501a3dcfb797a24b8fbf47c4

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

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

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

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

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

    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

1 entries across 1 versions & 1 rubygems

Version Path
katello-2.2.2 db/migrate/20140626204902_add_unlimited_to_host_collection.rb