Sha256: fa8e34980cb9945d2da907026cb9238cce621237743fab73f2f8d92efbf8c6c1

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

class FillInContentViewComponents < ActiveRecord::Migration
  class FakeContentView < ApplicationRecord
    self.table_name = 'katello_content_views'

    has_many :content_view_components, :class_name => "FakeContentViewVersion", :dependent => :destroy,
             :inverse_of => :composite_content_view, :foreign_key => :composite_content_view_id
  end

  class FakeContentViewVersion < ApplicationRecord
    self.table_name = 'katello_content_view_versions'

    has_many :content_view_components, :inverse_of => :content_view_version, :dependent => :destroy, :class_name => 'FakeContentViewComponent'
  end

  class FakeContentViewComponent < ApplicationRecord
    self.table_name = 'katello_content_view_components'

    belongs_to :content_view_version, :class_name => "FakeContentViewVersion",
                              :inverse_of => :content_view_components
    belongs_to :content_view, :class_name => "FakeContentView",
                              :inverse_of => :component_composites
  end

  def up
    FakeContentViewComponent.find_each do |cvc|
      if cvc.content_view_id.nil? && cvc.content_view_version_id
        cvc.content_view_id = cvc.content_view_version.content_view_id
        cvc.save!
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-3.5.2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.1.1 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.1 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.0.1 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.0 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.0.rc2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.5.0.rc1 db/migrate/20170321012632_fill_in_content_view_components.rb