From 6b959755e76685e6f0b62d67cb2a210d2b0ebf4c Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Thu, 21 May 2026 10:14:52 +0200 Subject: [PATCH] fix(migrations): backfill missing hwmon columns on existing DBs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cpu_load_percent + memory/disk columns were silently added inline to the hwmon migration entry, but PRAGMA user_version had already passed that index for existing deploys → ALTER never ran → replaceKioskKey and heartbeat hit "no such column: cpu_load_percent" on upgrade. Append a tail migration that addColumnIfNotExists for each. Lesson: never mutate an existing migration entry; always append a new one. --- server/src/plugins/service-store/migrations.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/src/plugins/service-store/migrations.ts b/server/src/plugins/service-store/migrations.ts index 283fb11..37ad06c 100644 --- a/server/src/plugins/service-store/migrations.ts +++ b/server/src/plugins/service-store/migrations.ts @@ -867,4 +867,17 @@ export const MIGRATIONS: readonly MigrationEntry[] = [ addColumnIfNotExists(db, "displays", "actual_power_state_at", "TEXT"); }, + // Backfill hwmon/telemetry columns. They were originally added inline to + // an earlier migration entry; existing deploys had already passed that + // index via PRAGMA user_version, so the new columns silently never landed. + // Re-add idempotently here so replaceKioskKey / heartbeat stop hitting + // "no such column" on upgrade. + (db: DatabaseSync) => { + addColumnIfNotExists(db, "kiosks", "cpu_load_percent", "REAL"); + addColumnIfNotExists(db, "kiosks", "memory_total_mb", "INTEGER"); + addColumnIfNotExists(db, "kiosks", "memory_used_mb", "INTEGER"); + addColumnIfNotExists(db, "kiosks", "disk_total_mb", "INTEGER"); + addColumnIfNotExists(db, "kiosks", "disk_free_mb", "INTEGER"); + addColumnIfNotExists(db, "kiosks", "disk_used_percent", "REAL"); + }, ];