20171222170246_create_messages.rb 312 B

123456789101112
  1. class CreateMessages < ActiveRecord::Migration[5.1]
  2. def change
  3. create_table :messages do |t|
  4. t.belongs_to :user, foreign_key: true
  5. t.belongs_to :conversation, foreign_key: true
  6. t.text :content
  7. t.timestamps
  8. end
  9. add_index :messages, [:conversation_id, :created_at]
  10. end
  11. end