feat: lecturer on class sessions and in the session course ref
The schedule showed a lecturer only where the session notes named one (Globalizacja), so the student plan had nobody under the other courses. The session JSON now carries the course lecturer in its course ref and an optional per-session lecturer (new nullable column, admin field, seed key) for courses shared between two people. The student app shows the session's own lecturer or, failing that, the course's.
This commit is contained in:
23
updates/20261017120000_add_lecturer_to_class_sessions.go
Normal file
23
updates/20261017120000_add_lecturer_to_class_sessions.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package updates
|
||||
|
||||
import (
|
||||
"github.com/go-gormigrate/gormigrate/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// AddLecturerToClassSessions returns the
|
||||
// 20261017120000_add_lecturer_to_class_sessions gormigrate entry: a class
|
||||
// session may name its own lecturer when it differs from the course's (the
|
||||
// lecture shared by two people across the semester). Empty means the
|
||||
// course's lecturer.
|
||||
func AddLecturerToClassSessions() *gormigrate.Migration {
|
||||
return &gormigrate.Migration{
|
||||
ID: "20261017120000_add_lecturer_to_class_sessions",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.Exec("ALTER TABLE jz_bm_class_sessions ADD COLUMN lecturer VARCHAR(255) NULL").Error
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
return tx.Exec("ALTER TABLE jz_bm_class_sessions DROP COLUMN IF EXISTS lecturer").Error
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user