Per-user checklists with items that may link a course, reading, deadline, material or own presentation deck. An item with a reading shares the reading's read mark. Student API routes with token twins, MCP tools, migrations, tests and README.
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package updates
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// CreateChecklists returns the 20261030120000_create_jz_bm_checklists
|
|
// gormigrate entry: a user's own checklists, e.g. one per zjazd to plan the
|
|
// preparation. They go with the golem15.user user; a deleted zjazd leaves
|
|
// the checklist without one.
|
|
func CreateChecklists() *gormigrate.Migration {
|
|
return &gormigrate.Migration{
|
|
ID: "20261030120000_create_jz_bm_checklists",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
return execAll(tx, `CREATE TABLE jz_bm_checklists (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
user_id INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
|
meeting_id BIGINT NULL REFERENCES jz_bm_meetings (id) ON DELETE SET NULL,
|
|
title VARCHAR(255) NOT NULL,
|
|
description TEXT NULL,
|
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
CREATE INDEX jz_bm_checklists_user_id_index ON jz_bm_checklists (user_id);
|
|
CREATE INDEX jz_bm_checklists_meeting_id_index ON jz_bm_checklists (meeting_id)`)
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec("DROP TABLE IF EXISTS jz_bm_checklists").Error
|
|
},
|
|
}
|
|
}
|