feat: add the study data models and schema migrations
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.
This commit is contained in:
21
updates/exec.go
Normal file
21
updates/exec.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package updates
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// execAll runs each semicolon-separated statement of sql in order. The
|
||||
// statements hold no semicolons of their own.
|
||||
func execAll(tx *gorm.DB, sql string) error {
|
||||
for _, stmt := range strings.Split(sql, ";") {
|
||||
if strings.TrimSpace(stmt) == "" {
|
||||
continue
|
||||
}
|
||||
if err := tx.Exec(stmt).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user