Commit 628bf9e6 authored by Zac Wood's avatar Zac Wood
Browse files

Created Instructor model

parent 2b2f88de
class Instructor < ApplicationRecord
end
class CreateInstructors < ActiveRecord::Migration[5.1]
def change
create_table :instructors do |t|
t.string :name
t.timestamps
end
end
end
class AddInstructorKeyToCourseSections < ActiveRecord::Migration[5.1]
def up
remove_column :course_sections, :instructor
add_reference :course_sections, :instructor, foreign_key: true
end
def down
remove_reference :course_sections, :instructor
add_column :course_sections, :instructor, :string
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180619011649) do
ActiveRecord::Schema.define(version: 20180910210737) do
create_table "closures", force: :cascade do |t|
t.date "date"
......@@ -25,7 +25,6 @@ ActiveRecord::Schema.define(version: 20180619011649) do
t.string "crn"
t.string "section_type"
t.string "title"
t.string "instructor"
t.date "start_date"
t.date "end_date"
t.string "days"
......@@ -39,7 +38,9 @@ ActiveRecord::Schema.define(version: 20180619011649) do
t.integer "course_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "instructor_id"
t.index ["course_id"], name: "index_course_sections_on_course_id"
t.index ["instructor_id"], name: "index_course_sections_on_instructor_id"
end
create_table "courses", force: :cascade do |t|
......@@ -51,6 +52,12 @@ ActiveRecord::Schema.define(version: 20180619011649) do
t.index ["semester_id"], name: "index_courses_on_semester_id"
end
create_table "instructors", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "semesters", force: :cascade do |t|
t.string "season"
t.string "year"
......
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
two:
name: MyString
require 'test_helper'
class InstructorTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment