Browse Source

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) <noreply@anthropic.com>
maziggy 2 months ago
parent
commit
3a09108457
1 changed files with 10 additions and 0 deletions
  1. 10 0
      backend/app/core/database.py

+ 10 - 0
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: