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.
30 lines
1.0 KiB
Go
30 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"
|
|
)
|
|
|
|
// CreateReadingProgress returns the 20261002120207_create_jz_bm_reading_progress gormigrate entry:
|
|
// who has read which reading. The rows go with the reading or the golem15.user user.
|
|
func CreateReadingProgress() *gormigrate.Migration {
|
|
return &gormigrate.Migration{
|
|
ID: "20261002120207_create_jz_bm_reading_progress",
|
|
Migrate: func(tx *gorm.DB) error {
|
|
return execAll(tx, `CREATE TABLE jz_bm_reading_progress (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
reading_id BIGINT NOT NULL REFERENCES jz_bm_readings (id) ON DELETE CASCADE,
|
|
user_id INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
|
read_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
UNIQUE (reading_id, user_id)
|
|
);
|
|
CREATE INDEX jz_bm_reading_progress_user_id_index ON jz_bm_reading_progress (user_id)`)
|
|
},
|
|
Rollback: func(tx *gorm.DB) error {
|
|
return tx.Exec("DROP TABLE IF EXISTS jz_bm_reading_progress").Error
|
|
},
|
|
}
|
|
}
|