Sha256: 4078bb1c428de2a63f2d1916860e0d86e4619ba76dd55477195a69ee62f56145
Contents?: true
Size: 609 Bytes
Versions: 47
Compression:
Stored size: 609 Bytes
Contents
class UpdateProductsAddOrganization < ActiveRecord::Migration class Katello::Product < ActiveRecord::Base belongs_to :provider self.inheritance_column = nil end def up add_column :katello_products, :organization_id, :integer, :null => true Katello::Product.all.each do |product| product.organization_id = product.provider.organization_id product.save! end change_column :katello_products, :organization_id, :integer, :null => false add_index :katello_products, :organization_id end def down remove_column :katello_products, :organization_id end end
Version data entries
47 entries across 47 versions & 1 rubygems