From ccae5ffeb16c8b692e0080bbf367f7537d120181 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Fri, 27 Feb 2026 04:06:01 +0530 Subject: [PATCH] fix: add error handling for missing dump file in migration script and update logging for migration step --- docker/scripts/install.sh | 2 ++ docker/scripts/migrate-database.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/scripts/install.sh b/docker/scripts/install.sh index fc14fc5cb..501a40221 100644 --- a/docker/scripts/install.sh +++ b/docker/scripts/install.sh @@ -178,6 +178,8 @@ if $MIGRATION_MODE; then wait_for_pg "${DB_USER}" step "Restoring database" + [[ -f "${DUMP_FILE}" ]] \ + || error "Dump file '${DUMP_FILE}' not found. The migration script may have failed.\n Check: ./surfsense-migration.log\n Or run manually: bash ${INSTALL_DIR}/scripts/migrate-database.sh --yes" info "Restoring dump into PostgreSQL 17 — this may take a while for large databases..." RESTORE_ERR="/tmp/surfsense_restore_err.log" diff --git a/docker/scripts/migrate-database.sh b/docker/scripts/migrate-database.sh index 8a7c9eae6..26b276dad 100755 --- a/docker/scripts/migrate-database.sh +++ b/docker/scripts/migrate-database.sh @@ -132,7 +132,7 @@ wait_for_pg() { success "${label} is ready." } -step "Migrating data from legacy database (PostgreSQL 14 → 17)" +info "Migrating data from legacy database (PostgreSQL 14 → 17)" # ── Step 0: Pre-flight checks ───────────────────────────────────────────────── step "0" "Pre-flight checks"