Sha256: 3424b1f5c92085df1350f7d9b1ad3f5ef835815f000e724c17196843a21cefba

Contents?: true

Size: 923 Bytes

Versions: 193

Compression:

Stored size: 923 Bytes

Contents

class MoveDefaultLocationToSettings < ActiveRecord::Migration[4.2]
  DEFAULT_LOCATION_SETTINGS = ['default_location_subscribed_hosts',
                               'default_location_puppet_content'].freeze
  def up
    default_location = Location.find_by(:katello_default => true)
    if default_location.present?
      DEFAULT_LOCATION_SETTINGS.each do |location_setting|
        Setting.find_by_name(location_setting).update_attribute(
          :value, default_location.title)
      end
    end
    remove_column :taxonomies, :katello_default
  end

  def down
    add_column :taxonomies, :katello_default, :boolean, :null => false,
      :default => false
    DEFAULT_LOCATION_SETTINGS.each do |location_setting|
      default_location = Location.find_by_title(Setting[location_setting])
      if default_location.present?
        default_location.update_attribute(:katello_default, true)
      end
    end
  end
end

Version data entries

193 entries across 193 versions & 1 rubygems

Version Path
katello-3.17.0.rc2 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.17.0.rc1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc5.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc5 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc4.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.3.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.3 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc4 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc3.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.2 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc3 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc2.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc2 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.1.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc1.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.16.0.rc1 db/migrate/20170125152421_move_default_location_to_settings.rb
katello-3.15.0.1 db/migrate/20170125152421_move_default_location_to_settings.rb