creddit/db/migrate/20150716155403_create_comments.rb

14 lines
341 B
Ruby

class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.references :user, index: true, foreign_key: true
t.references :post, index: true, foreign_key: true
t.string :ancestry
t.text :content
t.timestamps null: false
end
add_index :comments, :ancestry
end
end