Do not create backups for new databases
All checks were successful
Build / build (push) Successful in 1m27s

This commit is contained in:
Sebastiaan de Schaetzen 2025-03-24 12:07:42 +01:00
parent 87f10c73d6
commit 12a87a8762

View File

@ -42,7 +42,7 @@ func (d *Db) MigrateDb(filesystem ReadDirFileFS, directory string) error {
log.Printf("Current version is %d, max migration version is %d", currentVersion, latestVersion)
// Create a backup if we're not on the latest version
if currentVersion != latestVersion && d.source != ":memory:" {
if currentVersion != 0 && currentVersion != latestVersion && d.source != ":memory:" {
target := d.source + ".backup." + strconv.Itoa(currentVersion)
log.Printf("Creating backup of database to %s", target)
data, err := d.Db.Serialize("main")