diff --git a/app/models/recording.rb b/app/models/recording.rb new file mode 100644 index 0000000..4ffcd7c --- /dev/null +++ b/app/models/recording.rb @@ -0,0 +1,3 @@ +class Recording < ApplicationRecord + belongs_to :course +end diff --git a/db/migrate/20231001161500_create_recordings.rb b/db/migrate/20231001161500_create_recordings.rb new file mode 100644 index 0000000..ea0f42e --- /dev/null +++ b/db/migrate/20231001161500_create_recordings.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 5d22434..b575408 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/test/fixtures/recordings.yml b/test/fixtures/recordings.yml new file mode 100644 index 0000000..298c9d2 --- /dev/null +++ b/test/fixtures/recordings.yml @@ -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 diff --git a/test/models/recording_test.rb b/test/models/recording_test.rb new file mode 100644 index 0000000..05a9274 --- /dev/null +++ b/test/models/recording_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class RecordingTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end