Sha256: c9ff54208ad429c82f1ebdb149506cbb32e1c751b9a74409ae4574502c0dcaab

Contents?: true

Size: 698 Bytes

Versions: 179

Compression:

Stored size: 698 Bytes

Contents

class AddUpstreamNameToRepository < ActiveRecord::Migration[4.2]
  class FakeRepository < ApplicationRecord
    self.table_name = 'katello_repositories'
    scope :docker_type, -> { where(:content_type => 'docker') }
  end

  def up
    add_column :katello_repositories, :docker_upstream_name, :string, :limit => 255
    FakeRepository.docker_type.each do |repo|
      next if repo.url.blank?
      update %(
        update #{FakeRepository.table_name}
              set docker_upstream_name=#{ActiveRecord::Base.sanitize(repo.name)}
              where id=#{repo.id}
      ).gsub(/\s+/, " ").strip
    end
  end

  def down
    remove_column :katello_repositories, :docker_upstream_name
  end
end

Version data entries

179 entries across 179 versions & 1 rubygems

Version Path
katello-4.10.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.9.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.10.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.10.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.4 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.9.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.3 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.9.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.6 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.9.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.9.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.5 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.4 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.8.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.3 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb