20180219151405_create_course_participations.rb 350 B

12345678910111213
  1. class CreateCourseParticipations < ActiveRecord::Migration[5.1]
  2. def change
  3. create_table :course_participations do |t|
  4. t.belongs_to :course, foreign_key: true
  5. t.belongs_to :user, foreign_key: true
  6. t.integer :role
  7. t.timestamps
  8. end
  9. add_index :course_participations, [:user_id, :course_id], unique: true
  10. end
  11. end