Clean up SQLite dump temp files on failure

This commit is contained in:
2026-05-16 12:03:10 +02:00
parent 0e7e639df4
commit 12a87ad342
+5 -1
View File
@@ -81,7 +81,11 @@ dump_sqlite_file() {
tmp="$TMP_DIR/$(basename "$output").tmp"
log "Dumping SQLite database '$label' from $source"
rm -f "$tmp"
sqlite3 "$source" ".backup $tmp"
if ! sqlite3 "$source" ".backup $tmp"; then
warn "SQLite backup failed for $label"
rm -f "$tmp"
return 1
fi
if [ "$(sqlite3 "$tmp" 'PRAGMA quick_check;')" != "ok" ]; then
warn "SQLite quick_check failed for $label"
rm -f "$tmp"