mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 16:56:33 +00:00
fix(db): replace remaining hardcoded 0/1 with boolean params
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) <noreply@anthropic.com>
This commit is contained in:
parent
2e88d891e1
commit
41e9991891
1 changed files with 9 additions and 6 deletions
|
|
@ -137,10 +137,10 @@ export class Repository {
|
|||
async markSetupComplete(): Promise<void> {
|
||||
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<void> {
|
||||
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<Display> {
|
||||
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<void> {
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue