From 9b27b0a503aa46e806b8edda6b75276f81dc5d81 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sat, 31 Jan 2026 18:15:07 +0100 Subject: [PATCH 1/2] Fix missing sliced_for_model migration (Issue #211) The sliced_for_model column was added to the PrintArchive model for model-based queue assignment but the database migration was missing. This caused upgrades from 0.1.6b11 to 0.1.6 to fail with: "no such column: print_archives.sliced_for_model" Users' data was not deleted - just inaccessible due to query failures. --- backend/app/core/database.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/backend/app/core/database.py b/backend/app/core/database.py index 37ec8335c..0ab95b10b 100644 --- a/backend/app/core/database.py +++ b/backend/app/core/database.py @@ -34,6 +34,7 @@ async def get_db() -> AsyncSession: async def init_db(): # Import models to register them with SQLAlchemy from backend.app.models import ( # noqa: F401 + ams_history, api_key, archive, external_link, @@ -45,11 +46,13 @@ async def init_db(): maintenance, notification, notification_template, + pending_upload, print_queue, printer, project, project_bom, settings, + slot_preset, smart_plug, user, ) @@ -959,6 +962,38 @@ async def run_migrations(conn): except Exception: pass + # Migration: Add queue notification event columns to notification_providers + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_added BOOLEAN DEFAULT 0")) + except Exception: + pass + try: + await conn.execute( + text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_assigned BOOLEAN DEFAULT 0") + ) + except Exception: + pass + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_started BOOLEAN DEFAULT 0")) + except Exception: + pass + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_waiting BOOLEAN DEFAULT 1")) + except Exception: + pass + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_skipped BOOLEAN DEFAULT 1")) + except Exception: + pass + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_job_failed BOOLEAN DEFAULT 1")) + except Exception: + pass + try: + await conn.execute(text("ALTER TABLE notification_providers ADD COLUMN on_queue_completed BOOLEAN DEFAULT 0")) + except Exception: + pass + async def seed_notification_templates(): """Seed default notification templates if they don't exist.""" From 901ee42cfa127159927512134f5f91d037ecbec3 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sun, 1 Feb 2026 14:03:42 +0100 Subject: [PATCH 2/2] Fix missing sliced_for_model migration - for real this time (Issue #211) PR #215 claimed to fix this but the actual ALTER TABLE migration was not included. Users upgrading from 0.1.6b11 to 0.1.6 still see: "no such column: print_archives.sliced_for_model" This commit adds the actual migration that was missing. Closes #211 --- backend/app/core/database.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/app/core/database.py b/backend/app/core/database.py index 0ab95b10b..19a42a0e7 100644 --- a/backend/app/core/database.py +++ b/backend/app/core/database.py @@ -709,6 +709,12 @@ async def run_migrations(conn): except Exception: pass + # Migration: Add sliced_for_model column to print_archives for model-based queue assignment + try: + await conn.execute(text("ALTER TABLE print_archives ADD COLUMN sliced_for_model VARCHAR(50)")) + except Exception: + pass + # Migration: Add is_external column to library_files for external cloud files try: await conn.execute(text("ALTER TABLE library_files ADD COLUMN is_external BOOLEAN DEFAULT 0"))