Add Recording model

This commit is contained in:
Joshua Coles 2023-10-01 17:16:08 +01:00
parent 3300017d98
commit 69a97a3fa9
5 changed files with 47 additions and 1 deletions

3
app/models/recording.rb Normal file
View File

@ -0,0 +1,3 @@
class Recording < ApplicationRecord
belongs_to :course
end

View File

@ -0,0 +1,12 @@
class CreateRecordings < ActiveRecord::Migration[7.0]
def change
create_table :recordings do |t|
t.string :title, null: false
t.string :start_time, null: false
t.string :recording_uuid, null: false
t.references :course, null: false, foreign_key: true
t.timestamps
end
end
end

13
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_201903) do
ActiveRecord::Schema[7.0].define(version: 2023_10_01_161500) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -44,5 +44,16 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_29_201903) do
t.index ["recording_id"], name: "index_lectures_on_recording_id", unique: true
end
create_table "recordings", force: :cascade do |t|
t.string "title", null: false
t.string "start_time", null: false
t.string "recording_uuid", null: false
t.bigint "course_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["course_id"], name: "index_recordings_on_course_id"
end
add_foreign_key "attendances", "lectures"
add_foreign_key "recordings", "courses"
end

13
test/fixtures/recordings.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
start_time: MyString
recording_uuid: MyString
course_id: one
two:
title: MyString
start_time: MyString
recording_uuid: MyString
course_id: two

View File

@ -0,0 +1,7 @@
require "test_helper"
class RecordingTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end