osem-fcy/db/migrate/20130104142209_create_comments.rb
2013-01-07 09:04:09 +01:00

19 lines
453 B
Ruby

class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.string :title, :limit => 50, :default => ""
t.text :comment
t.references :commentable, :polymorphic => true
t.references :user
t.timestamps
end
add_index :comments, :commentable_type
add_index :comments, :commentable_id
add_index :comments, :user_id
end
def self.down
drop_table :comments
end
end