Adjusted imports in migrations
This commit is contained in:
parent
4fb84b47d0
commit
c75026c834
2 changed files with 9 additions and 13 deletions
|
|
@ -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__))
|
||||
|
|
|
|||
|
|
@ -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 = []
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue