Sha256: 056b82e83616395b5fd79980bc04e6b01832a3c6218b117a48566f2f5b47500f

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

class FillInContentViewComponents < ActiveRecord::Migration
  class FakeContentView < ActiveRecord::Base
    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 < ActiveRecord::Base
    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 < ActiveRecord::Base
    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

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.4.5 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.4 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.1 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.0.2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.0.1 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.3.2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.0 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.0.rc2 db/migrate/20170321012632_fill_in_content_view_components.rb
katello-3.4.0.rc1 db/migrate/20170321012632_fill_in_content_view_components.rb