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.
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
// Code generated by summer make. DO NOT EDIT.
|
|
|
|
package updates
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// CreateReadings returns the 20261002120206_create_jz_bm_readings gormigrate entry:
|
|
// the lektury. Deleting a course deletes its readings.
|
|
func CreateReadings() *gormigrate.Migration {
|
|
return &gormigrate.Migration{
|
|
ID: "20261002120206_create_jz_bm_readings",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
return execAll(tx, `CREATE TABLE jz_bm_readings (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
course_id BIGINT NOT NULL REFERENCES jz_bm_courses (id) ON DELETE CASCADE,
|
|
title VARCHAR(500) NOT NULL,
|
|
author VARCHAR(255) NULL,
|
|
source VARCHAR(500) NULL,
|
|
url VARCHAR(2048) NULL,
|
|
is_required BOOLEAN NOT NULL DEFAULT FALSE,
|
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
UNIQUE (course_id, title)
|
|
)`)
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec("DROP TABLE IF EXISTS jz_bm_readings").Error
|
|
},
|
|
}
|
|
}
|