error when version missing

This commit is contained in:
qwerty287 2024-07-20 12:26:18 +02:00
parent 17e9d32405
commit 6c057fec6e
No known key found for this signature in database
1 changed files with 2 additions and 8 deletions

View File

@ -270,14 +270,8 @@ func MigrateToXormigrate(x *xorm.Engine) error {
if err != nil { if err != nil {
return fmt.Errorf("get: %w", err) return fmt.Errorf("get: %w", err)
} else if !has { } else if !has {
// If the version record does not exist we think // This should not happen
// it is a fresh installation and we can skip all migrations. return fmt.Errorf("could not get version", err)
currentVersion.ID = 0
currentVersion.Version = expectedVersion
if _, err = x.InsertOne(currentVersion); err != nil {
return fmt.Errorf("insert: %w", err)
}
} }
v := currentVersion.Version v := currentVersion.Version