From d5fdc9a8d933d2e8e740db31f6770a6c74aab630 Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Thu, 15 Jan 2026 10:21:30 +0100 Subject: [PATCH] Auto-commit local changes before build (2026-01-15 10:21:30) --- .last-branch | 2 +- .../src/backend/app/migrations.py | 22 +++++++++++++++++++ docs/changelog.md | 19 ++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.last-branch b/.last-branch index 2133928..edd3b74 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260115-01-autotask-settings +v20260115-02-autotask-settings-migration-fix diff --git a/containers/backupchecks/src/backend/app/migrations.py b/containers/backupchecks/src/backend/app/migrations.py index eae1fd4..61dddae 100644 --- a/containers/backupchecks/src/backend/app/migrations.py +++ b/containers/backupchecks/src/backend/app/migrations.py @@ -22,6 +22,27 @@ def _is_column_nullable(table_name: str, column_name: str) -> bool: return False +def _column_exists_on_conn(conn, table_name: str, column_name: str) -> bool: + """Return True if the given column exists using the provided connection. + + This helper is useful inside engine.begin() blocks so we can check + column existence without creating a new inspector/connection. + """ + result = conn.execute( + text( + """ + SELECT 1 + FROM information_schema.columns + WHERE table_name = :table + AND column_name = :column + LIMIT 1 + """ + ), + {"table": table_name, "column": column_name}, + ) + return result.first() is not None + + def migrate_add_username_to_users() -> None: """Ensure users.username column exists and is NOT NULL and UNIQUE. @@ -820,6 +841,7 @@ def run_migrations() -> None: migrate_system_settings_auto_import_cutoff_date() migrate_system_settings_daily_jobs_start_date() migrate_system_settings_ui_timezone() + migrate_system_settings_autotask_integration() migrate_mail_messages_columns() migrate_mail_messages_parse_columns() migrate_mail_messages_approval_columns() diff --git a/docs/changelog.md b/docs/changelog.md index 0ac4238..e0197d5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,22 @@ +## v20260115-01-autotask-settings + +Changes: +- Added initial Autotask integration settings structure to Backupchecks. +- Introduced new system settings demonstrating Autotask configuration fields such as enable toggle, environment selection, credentials, tracking identifier, and Backupchecks base URL. +- Prepared data model and persistence layer to store Autotask-related configuration. +- Laid groundwork for future validation and integration logic without enabling ticket creation or customer mapping. +- Ensured changes are limited to configuration foundations only, keeping Phase 1 scope intact. + +## + +v20260115-02-autotask-settings-migration-fix + +Changes: +- Fixed Autotask system settings migration so it is always executed during application startup. +- Added safe, idempotent column existence checks to prevent startup failures on re-deployments. +- Ensured all Autotask-related system_settings columns are created before being queried. +- Prevented aborted database transactions caused by missing columns during settings initialization. +- Improved overall stability of the Settings page when Autotask integration is enabled. ***