chore: simplify db schema creation (#26693)

This commit is contained in:
andig 2026-01-14 14:43:01 +01:00 • committed by GitHub
parent ad014333b2
commit 45741b1c90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 35 additions and 47 deletions

View file

@ -13,17 +13,15 @@ type DB struct {
name string
}
var (
sessions Sessions
)
var sessions Sessions
func init() {
db.Register(func() error {
if err := db.Instance.AutoMigrate(new(Session)); err != nil {
db.Register(func(db *gorm.DB) error {
if err := db.AutoMigrate(new(Session)); err != nil {
return err
}
return db.Instance.Find(&sessions).Error
return db.Find(&sessions).Error
})
}