Files
astuto/db/migrate/20190916131938_create_comments.rb
2019-09-16 16:05:00 +02:00

13 lines
335 B
Ruby

class CreateComments < ActiveRecord::Migration[6.0]
def change
create_table :comments do |t|
t.text :body
t.references :user, null: false, foreign_key: true
t.references :post, null: false, foreign_key: true
t.references :parent, foreign_key: { to_table: :comments }
t.timestamps
end
end
end