Sha256: a459e87a3147df90be363eebc7e9b78c5a223b521f23f09f756b3fd1c1efdb12
Contents?: true
Size: 608 Bytes
Versions: 7
Compression:
Stored size: 608 Bytes
Contents
class UpdateProductsAddOrganization < ActiveRecord::Migration class Katello::Product < ApplicationRecord 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
7 entries across 7 versions & 1 rubygems