From 41e9991891869f640f58e0b56cb4ee98ee47937d Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Sun, 24 May 2026 05:18:43 +0200 Subject: [PATCH] fix(db): replace remaining hardcoded 0/1 with boolean params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setup_state.is_complete, cluster_key_provisioned, display.is_primary, event_log.forwarded_to_nodered all had literal 0/1 in SQL strings. PG rejects integer for BOOLEAN columns. Changed to ? params with true/false values — SQLite adapter coerces to 1/0 automatically. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/src/shared/db/repository.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/src/shared/db/repository.ts b/server/src/shared/db/repository.ts index eec3027..6918866 100644 --- a/server/src/shared/db/repository.ts +++ b/server/src/shared/db/repository.ts @@ -137,10 +137,10 @@ export class Repository { async markSetupComplete(): Promise { await this._run( `UPDATE setup_state - SET is_complete = 1, + SET is_complete = ?, completed_at = COALESCE(completed_at, ?) WHERE id = 1`, - [isoNow()], + [true, isoNow()], ); void this.notify("setup_state", "update", 1); } @@ -157,7 +157,8 @@ export class Repository { async markClusterKeyProvisioned(): Promise { await this._run( - "UPDATE setup_state SET cluster_key_provisioned = 1 WHERE id = 1", + "UPDATE setup_state SET cluster_key_provisioned = ? WHERE id = 1", + [true], ); } @@ -380,7 +381,8 @@ export class Repository { async createDefaultDisplay(): Promise { const result = await this._run( `INSERT INTO displays (name, "index", is_primary) - VALUES ('primary', 0, 0) RETURNING id`, + VALUES ('primary', 0, ?) RETURNING id`, + [false], ); const id = Number(result.lastInsertRowid); void this.notify("displays", "create", id); @@ -398,10 +400,11 @@ export class Repository { const idx = input.index ?? await this.nextDisplayIndexForKiosk(kioskId); const result = await this._run( `INSERT INTO displays (name, "index", is_primary, kiosk_id, width_px, height_px) - VALUES (?, ?, 0, ?, ?, ?) RETURNING id`, + VALUES (?, ?, ?, ?, ?, ?) RETURNING id`, [ input.name, idx, + false, kioskId, input.width_px ?? 1920, input.height_px ?? 1080, @@ -1845,7 +1848,7 @@ export class Repository { } async markEventForwarded(eventId: number): Promise { - await this._run("UPDATE event_log SET forwarded_to_nodered = 1 WHERE id = ?", [eventId]); + await this._run("UPDATE event_log SET forwarded_to_nodered = ? WHERE id = ?", [true, eventId]); } /**