From c75026c8342e94436cb96b70d77378572f29ed0f Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Fri, 17 Jul 2026 09:50:36 -0400 Subject: [PATCH] Adjusted imports in migrations --- core/Constants.py | 2 +- core/models/manage/migrations.py | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/core/Constants.py b/core/Constants.py index fceabe2..20dc285 100644 --- a/core/Constants.py +++ b/core/Constants.py @@ -6,7 +6,7 @@ import os @dataclass(frozen=True) class Constants: - DB_VERSION_THIS_APP_WANTS = 2 + DB_VERSION_THIS_APP_WANTS = 1 # Fallback for development (running outside AppImage) fallback_non_appimage = os.path.dirname(os.path.abspath(__file__)) diff --git a/core/models/manage/migrations.py b/core/models/manage/migrations.py index f61a195..eda6477 100644 --- a/core/models/manage/migrations.py +++ b/core/models/manage/migrations.py @@ -61,19 +61,15 @@ def get_model_columns(model_class): def migrate_sql() -> DatabaseOperation: from core.models.manage.session_management import engine from core.models.orm_models.Base import BaseModel, Base - made_tables = create_ALL_tables() - if made_tables: - logger.info(f"[MIGRATION] Tables loaded") + try: + from core.models.orm_models.Location import Location + from core.models.orm_models.Operator import Operator + from core.models.orm_models.CachedSync import CachedSync + from core.models.orm_models.EncryptedProxy import EncryptedProxy MODELS = [Location, Operator, CachedSync, EncryptedProxy] - else: - logger.error(f"[MIGRATION] Huge issue with loading the tables via Session management. Trying again within migrations") - try: - from core.models.orm_models.Location import Location - from core.models.orm_models.Operator import Operator - from core.models.orm_models.CachedSync import CachedSync - from core.models.orm_models.EncryptedProxy import EncryptedProxy - except: - logger.error(f"[MIGRATION] Second try to load the tables failed.") + logger.info(f"[MIGRATION] Tables loaded") + except: + logger.error(f"[MIGRATION] Could not load models. Critical failure.") changes_made = []