Add Recording model
This commit is contained in:
parent
3300017d98
commit
69a97a3fa9
3
app/models/recording.rb
Normal file
3
app/models/recording.rb
Normal file
@ -0,0 +1,3 @@
|
||||
class Recording < ApplicationRecord
|
||||
belongs_to :course
|
||||
end
|
||||
12
db/migrate/20231001161500_create_recordings.rb
Normal file
12
db/migrate/20231001161500_create_recordings.rb
Normal 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
13
db/schema.rb
generated
@ -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
13
test/fixtures/recordings.yml
vendored
Normal 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
|
||||
7
test/models/recording_test.rb
Normal file
7
test/models/recording_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class RecordingTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user