Class: CreateProducts
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateProducts
- Defined in:
- lib/generators/templates/create_products.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
19 20 21 |
# File 'lib/generators/templates/create_products.rb', line 19 def self.down drop_table :products end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/templates/create_products.rb', line 2 def self.up create_table :products, :force => true do |t| t.string :title t.string :slug t.text :body t.integer :price_cents, :default => 0 t.string :price_currency t.string :state t.datetime :published_at t.integer :likes_count, :default => 0 t.integer :votes_count, :default => 0 t. end add_index :products, :likes_count add_index :products, :votes_count end |