Make lectures belong to courses

This commit is contained in:
Joshua Coles 2023-09-29 18:20:43 +01:00
parent 38f48d1736
commit 376e80e385
3 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,6 @@
class Lecture < ApplicationRecord
belongs_to :course
enum :status, [
:future,
:live,

View File

@ -0,0 +1,5 @@
class AddCourseIdToLectures < ActiveRecord::Migration[7.0]
def change
add_belongs_to(:lectures, :course)
end
end

4
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_29_171730) do
ActiveRecord::Schema[7.0].define(version: 2023_09_29_171856) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -30,6 +30,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_29_171730) do
t.string "recording_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "course_id"
t.index ["course_id"], name: "index_lectures_on_course_id"
end
end