refactor: initialize expert catalog from initdb

This commit is contained in:
2026-07-23 14:24:01 +08:00
parent bb90ed1d38
commit 6e7be2f3a4
8 changed files with 206 additions and 124 deletions

View File

@@ -4,5 +4,10 @@ import "gorm.io/gorm"
// New initializes the default database records.
func New(database *gorm.DB) error {
return InitUser(database)
return database.Transaction(func(tx *gorm.DB) error {
if err := InitUser(tx); err != nil {
return err
}
return InitExpert(tx)
})
}