Class: CreatePersonRatings

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

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
# File 'lib/generators/coletivo/templates/person_ratings_migration.rb', line 18

def self.down
  drop_table :person_ratings
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/coletivo/templates/person_ratings_migration.rb', line 2

def self.up
  create_table :person_ratings do |t|
    t.integer :person_id
    t.string  :person_type

    t.integer :rateable_id
    t.string  :rateable_type

    t.decimal :weight, :precision => 5, :scale => 2

    t.timestamps
  end

  add_index :person_ratings, :rateable_type, :unique => false
end