Sha256: 67e7a2a0f26df71c0529cec8d53d92104e16a841831f319cc6fbacda2fb37b00

Contents?: true

Size: 613 Bytes

Versions: 105

Compression:

Stored size: 613 Bytes

Contents

class UpdateProductsAddOrganization < ActiveRecord::Migration[4.2]
  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

105 entries across 105 versions & 1 rubygems

Version Path
katello-4.0.3 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.5 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.2.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.2 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.4 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.1.2 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.3.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.1.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.3 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.0 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.0.rc3.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.0.rc3 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.2.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.2 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.17.3 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.0.rc2 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.18.1.1 db/migrate/20140422000001_update_products_add_organization.rb
katello-3.17.2 db/migrate/20140422000001_update_products_add_organization.rb
katello-4.0.0.rc1 db/migrate/20140422000001_update_products_add_organization.rb