From 7edf0df1acef4e136f6232d26d2af37b9fbcd5b6 Mon Sep 17 00:00:00 2001 From: Chrystian Huot Date: Sun, 17 May 2026 08:57:24 -0400 Subject: [PATCH] fix: streamline error handling in migrateCalls function --- server/migrations.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/migrations.go b/server/migrations.go index baa6908..9c13b92 100644 --- a/server/migrations.go +++ b/server/migrations.go @@ -425,8 +425,7 @@ func migrateCalls(db *Database) error { query = fmt.Sprintf(`SELECT COUNT(*) FROM "units" WHERE "systemId" = %d AND "unitRef" = %d`, systems[systemRef.Int32], source.Int32) if err = tx.QueryRow(query).Scan(&c); err == nil && c == 0 { query = fmt.Sprintf(`INSERT INTO "units" ("label", "systemId", "unitRef") VALUES(%d, %d, %d)`, source.Int32, systems[systemRef.Int32], source.Int32) - - if err == nil { + if _, err = tx.Exec(query); err != nil { query = fmt.Sprintf(`INSERT INTO "callUnits" ("callId", "offset", "unitRef") VALUES (%d, %d, %d)`, call.Id, 0, source.Int32) if _, err = tx.Exec(query); err != nil { log.Println(formatError(err, query))