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.7.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.2.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.7.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.2.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.2.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.5.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.6.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.5.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.5.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.5.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.0.2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.4.0.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb