Update lecture properties and various migration changes

Modified code to remove 'status' field from lecture's table and added 'event_uuid' field. Also refined the 'start_time' field in recordings' table to handle datetime instead of strings. Further, made minor changes in scraping jobs and seeding logic. Implemented these changes to allow lectures to be associated with calendar events and streamlined various fields.
This commit is contained in:
2023-10-01 19:44:20 +01:00
parent 070816f0a2
commit d9d182bc94
13 changed files with 153 additions and 36 deletions
@@ -0,0 +1,8 @@
class UpdateLectureProperties < ActiveRecord::Migration[7.0]
def change
remove_column :lectures, :status
# Optional association with an event in the calendar
add_column :lectures, :event_uuid, :string, null: true
end
end
@@ -0,0 +1,5 @@
class ChangeRecordingStartTimeType < ActiveRecord::Migration[7.0]
def change
change_column :recordings, :start_time, :datetime, using: 'start_time::timestamp'
end
end
Generated
+3 -3
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_10_01_165128) do
ActiveRecord::Schema[7.0].define(version: 2023_10_01_183712) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -36,18 +36,18 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_01_165128) do
create_table "lectures", force: :cascade do |t|
t.string "title", null: false
t.datetime "start_time", null: false
t.integer "status", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "course_id"
t.bigint "recording_id"
t.string "event_uuid"
t.index ["course_id"], name: "index_lectures_on_course_id"
t.index ["recording_id"], name: "index_lectures_on_recording_id"
end
create_table "recordings", force: :cascade do |t|
t.string "title", null: false
t.string "start_time", null: false
t.datetime "start_time", null: false
t.string "recording_uuid", null: false
t.bigint "course_id", null: false
t.datetime "created_at", null: false
+16
View File
@@ -5,3 +5,19 @@
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)
Course.create!(
title: 'General Relativity',
panopto_folders: ["5a77867a-236b-478f-9b0d-af2400ed0989"],
toggl_project: 189467492,
unit_code: 'PH30101',
semester_start_date: Date.parse('2023-02-06'),
)
Course.create!(
title: 'Continuum mechanics',
panopto_folders: ["dca2c510-49b4-4a24-9c91-b07701022d03"],
toggl_project: 195482340,
unit_code: 'MA30253',
semester_start_date: START_OF_YEAR_5_SEMESTER_1.to_date,
)