Class: CreateProducts

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/create_products.rb

Class Method Summary collapse

Class Method Details

.downObject



19
20
21
# File 'lib/generators/templates/create_products.rb', line 19

def self.down
  drop_table :products
end

.upObject



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.timestamps
  end
  add_index :products, :likes_count
  add_index :products, :votes_count
end