Browse Source

fix(db): only vacuum database on startup when a migration script was actually run (#10339)

Tommy van der Vorst 1 month ago
parent
commit
6e9ccf7211
1 changed files with 1 additions and 1 deletions
  1. 1 1
      internal/db/sqlite/basedb.go

+ 1 - 1
internal/db/sqlite/basedb.go

@@ -110,6 +110,7 @@ func openBase(path string, maxConns int, pragmas, schemaScripts, migrationScript
 			}
 			if int(n) > ver.SchemaVersion {
 				slog.Info("Applying database migration", slogutil.FilePath(db.baseName), slog.String("script", scr))
+				shouldVacuum = true
 				return true
 			}
 			return false
@@ -118,7 +119,6 @@ func openBase(path string, maxConns int, pragmas, schemaScripts, migrationScript
 			if err := db.runScripts(tx, script, filter); err != nil {
 				return nil, wrap(err)
 			}
-			shouldVacuum = true
 		}
 	}