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.15.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.15.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.0.rc3 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.0.rc1.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.14.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.13.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.13.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.12.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.13.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.12.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.12.0.rc3 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.12.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.12.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.11.1 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.11.0 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.11.0.rc2 db/migrate/20150114225023_add_upstream_name_to_repository.rb
katello-4.11.0.rc1 db/migrate/20150114225023_add_upstream_name_to_repository.rb