photomix/db/migrate/20120724213209_create_rates.rb

19 lines
403 B
Ruby
Raw Permalink Normal View History

2012-07-26 22:26:23 +02:00
class CreateRates < ActiveRecord::Migration
def self.up
create_table :rates do |t|
t.belongs_to :rater
t.belongs_to :rateable, :polymorphic => true
t.integer :stars, :null => false
t.string :dimension
t.timestamps
end
add_index :rates, :rater_id
add_index :rates, [:rateable_id, :rateable_type]
end
def self.down
drop_table :rates
end
end