File size: 360 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class CreateComments < ActiveRecord::Migration[5.2]
  def change
    create_table :comments do |t|
      t.integer :author_id, null: false
      t.integer :post_id, null: false
      t.integer :parent_id, default: nil
      t.string :body, null: false
      t.timestamps
    end

    add_index :comments, :post_id
    add_index :comments, :parent_id
  end
end