migration and associations

completes #26
This commit is contained in:
Mark Moser
2016-09-15 13:26:31 -05:00
parent 372e86507e
commit 2233d73c39
9 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class CreateReviewerToQuizzes < ActiveRecord::Migration[5.0]
def change
create_table :reviewer_to_quizzes do |t|
t.integer :user_id, null: false
t.integer :quiz_id, null: false
t.timestamps
end
add_index :reviewer_to_quizzes, :quiz_id
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160826200610) do
ActiveRecord::Schema.define(version: 20160915164450) do
create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "candidate_id"
@ -65,6 +65,14 @@ ActiveRecord::Schema.define(version: 20160826200610) do
t.string "name"
end
create_table "reviewer_to_quizzes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "user_id", null: false
t.integer "quiz_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["quiz_id"], name: "index_reviewer_to_quizzes_on_quiz_id", using: :btree
end
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "name"
t.string "email"