diff --git a/migrator.go b/migrator.go index 7c4b258..f67af1b 100644 --- a/migrator.go +++ b/migrator.go @@ -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")