Sha256: ff97b49c4d685d5e0213fdd329311a796b71db06c43bfaa1886314889b0e587d

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

class AddPartsFieldsToProducts < ActiveRecord::Migration
  def self.up
    table = if table_exists?(:products)
      'products'
    elsif table_exists?(:spree_products)
      'spree_products'
    end 
    
    change_table(table) do |t|
      t.column :can_be_part, :boolean, :default => false, :null => false
      t.column :individual_sale, :boolean, :default => true, :null => false
    end  
  end

  def self.down
    table = if table_exists?(:products)
      'products'
    elsif table_exists?(:spree_products)
      'spree_products'
    end 
    
    change_table(table) do |t|
      t.remove :can_be_part
      t.remove :individual_sale
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
solidus_product_bundle-1.0.1 db/migrate/20091029165620_add_parts_fields_to_products.rb
solidus_product_bundle-1.0.0 db/migrate/20091029165620_add_parts_fields_to_products.rb
solidus_product_assembly-1.0.0 db/migrate/20091029165620_add_parts_fields_to_products.rb