Sha256: 5ac4578c235e80eb7c62215ab749de2d34df64892e65e62d1b67906c01feb508
Contents?: true
Size: 838 Bytes
Versions: 4
Compression:
Stored size: 838 Bytes
Contents
class PopulateSccKatelloRepositories < ActiveRecord::Migration[6.0] class SccProduct < ApplicationRecord belongs_to :product, class_name: 'Katello::Product' has_and_belongs_to_many :scc_repositories end class SccRepository < ApplicationRecord has_many :scc_katello_repositories has_many :katello_root_repositories, through: :scc_katello_repositories has_and_belongs_to_many :scc_products end def up SccProduct.where.not(product_id: nil).each do |scc_p| scc_p.scc_repositories.each do |scc_r| # find all Katello repositories that were derived from that SCC repository katello_repos = Katello::RootRepository.where('label like ?', "%#{::Katello::Util::Model.labelize(scc_r.description)}%") scc_r.update!(katello_root_repositories: katello_repos) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems