Sha256: 98b058c8d6861cabf6ea8637abe554ad24115b8d955438d3215c42284f9fe900
Contents?: true
Size: 837 Bytes
Versions: 7
Compression:
Stored size: 837 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
7 entries across 7 versions & 1 rubygems