Courses, meetings, class sessions, deadlines, readings with per-user progress, materials with tags and file attachments. Timestamps are stored in UTC and held as Europe/Warsaw text so the admin text inputs can write them.
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// Code generated by summer make. DO NOT EDIT.
|
|
|
|
package updates
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// CreateCourses returns the 20261002120203_create_jz_bm_courses gormigrate entry:
|
|
// the przedmioty, one row per course and form.
|
|
func CreateCourses() *gormigrate.Migration {
|
|
return &gormigrate.Migration{
|
|
ID: "20261002120203_create_jz_bm_courses",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
return execAll(tx, `CREATE TABLE jz_bm_courses (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
code VARCHAR(50) NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
form VARCHAR(20) NOT NULL CHECK (form IN ('wyklad', 'cwiczenia', 'konwersatorium', 'seminarium', 'inne')),
|
|
lecturer VARCHAR(255) NULL,
|
|
semester INTEGER NOT NULL CHECK (semester > 0),
|
|
ects NUMERIC(4,1) NULL,
|
|
assessment VARCHAR(100) NULL,
|
|
description TEXT NULL,
|
|
syllabus_url VARCHAR(2048) NULL,
|
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
UNIQUE (name, form, semester)
|
|
);
|
|
CREATE INDEX jz_bm_courses_semester_sort_index ON jz_bm_courses (semester, sort_order)`)
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec("DROP TABLE IF EXISTS jz_bm_courses").Error
|
|
},
|
|
}
|
|
}
|