2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2013-01-07 09:04:09 +01:00
|
|
|
class CreateComments < ActiveRecord::Migration
|
|
|
|
|
def self.up
|
|
|
|
|
create_table :comments do |t|
|
2014-08-18 21:54:43 +03: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
|