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 {
return fmt.Errorf("get: %w", err)
} else if !has {
// If the version record does not exist we think
// it is a fresh installation and we can skip all migrations.
currentVersion.ID = 0
currentVersion.Version = expectedVersion
if _, err = x.InsertOne(currentVersion); err != nil {
return fmt.Errorf("insert: %w", err)
}
// This should not happen
return fmt.Errorf("could not get version", err)
}
v := currentVersion.Version