Sha256: 5d561250d78975e40bd820c990c5c3d60f254ed50598a4a3d4ae600caf4cc254

Contents?: true

Size: 518 Bytes

Versions: 6

Compression:

Stored size: 518 Bytes

Contents

class CreateProducts < ActiveRecord::Migration
  def change
    create_table :products do |t|
      t.belongs_to :category, null: false
      t.boolean :active, default: true
      t.string :name, null: false
      t.string :slug
      t.text :description
      t.float :price, null: false
      t.integer :sort, default: 500

      t.timestamps
    end

    add_index :products, :slug, unique: true
    add_index :products, :category_id

    add_column :categories, :products_count, :integer, :default => 0
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
power_shop-0.2.4 db/migrate/20140728071046_create_products.rb
power_shop-0.2.3 db/migrate/20140728071046_create_products.rb
power_shop-0.2.2 db/migrate/20140728071046_create_products.rb
power_shop-0.2.1 db/migrate/20140728071046_create_products.rb
power_shop-0.2.0 db/migrate/20140728071046_create_products.rb
power_shop-0.1.1 db/migrate/20140728071046_create_products.rb