From 3a0910845729a4b8c620d78c38534636ae86c5e3 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sun, 22 Mar 2026 14:11:45 +0100 Subject: [PATCH] Add missing migration for spoolbuddy update_status columns The OTA update feature added update_status and update_message to the SpoolBuddyDevice model but no ALTER TABLE migration, causing "no such column: spoolbuddy_devices.update_status" on existing databases. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/core/database.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/app/core/database.py b/backend/app/core/database.py index 21659d9d1..53ce76387 100644 --- a/backend/app/core/database.py +++ b/backend/app/core/database.py @@ -1396,6 +1396,16 @@ async def run_migrations(conn): except OperationalError: pass # Already applied + # Migration: Add OTA update tracking columns to spoolbuddy_devices + try: + await conn.execute(text("ALTER TABLE spoolbuddy_devices ADD COLUMN update_status VARCHAR(20)")) + except OperationalError: + pass # Already applied + try: + await conn.execute(text("ALTER TABLE spoolbuddy_devices ADD COLUMN update_message VARCHAR(255)")) + except OperationalError: + pass # Already applied + # Migration: Convert ams_labels table from (printer_id, ams_id) key to ams_serial_number key # Labels are now keyed by AMS serial number so they persist when the AMS is moved to another printer. try: