osem-fcy/db/migrate/20130104142209_create_comments.rb

20 lines
444 B
Ruby
Raw Normal View History

2013-01-07 09:04:09 +01:00
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
2014-07-21 14:49:05 +02:00
t.string :title, limit: 50, default: ""
2013-01-07 09:04:09 +01:00
t.text :comment
2014-07-21 14:49:05 +02:00
t.references :commentable, polymorphic: true
2013-01-07 09:04:09 +01:00
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