Sha256: 54015ec03c76b5dc1e85f1695526474945bda663b2ae47b5a306da24b4b521ab

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

class CreateProducts < ActiveRecord::Migration
  def self.up
    create_table :products do |t|
      t.string :type,
        :sku
      t.integer :stock, :default => 0
      t.float :price,
        :rate_tax,
        :default => 0.0,
        :null => false
      t.float :weight,
        :default => 0.0
      t.belongs_to :product_type,
        :brand,
        :redirection_product
      t.date :selling_date
      t.boolean :stop_sales,
        :offer_month,
        :on_first_page,
        :deleted,
        :default => false, :null => false
      t.boolean :active, :default => true, :null => false
      t.timestamps
    end
    add_index :products, [:sku, :active, :deleted]
    add_index :products, :sku, :uniq => true

    Product.create_translation_table!(:name => :string, :url => :string, :description => :text, :summary => :string)
  end

  def self.down
    Product.drop_translation_table!
    remove_index :products, :columns => [:sku, :active, :deleted]
    remove_index :products, :columns => [:sku]
    drop_table :products
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forgeos_commerce-1.9.1.rc1 db/migrate/20091009134813_create_products.rb
forgeos_commerce-1.9.0 db/migrate/20091009134813_create_products.rb