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)
|
@dataclass(frozen=True)
|
||||||
class Constants:
|
class Constants:
|
||||||
|
|
||||||
DB_VERSION_THIS_APP_WANTS = 2
|
DB_VERSION_THIS_APP_WANTS = 1
|
||||||
|
|
||||||
# Fallback for development (running outside AppImage)
|
# Fallback for development (running outside AppImage)
|
||||||
fallback_non_appimage = os.path.dirname(os.path.abspath(__file__))
|
fallback_non_appimage = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
|
||||||
|
|
@ -61,19 +61,15 @@ def get_model_columns(model_class):
|
||||||
def migrate_sql() -> DatabaseOperation:
|
def migrate_sql() -> DatabaseOperation:
|
||||||
from core.models.manage.session_management import engine
|
from core.models.manage.session_management import engine
|
||||||
from core.models.orm_models.Base import BaseModel, Base
|
from core.models.orm_models.Base import BaseModel, Base
|
||||||
made_tables = create_ALL_tables()
|
|
||||||
if made_tables:
|
|
||||||
logger.info(f"[MIGRATION] Tables loaded")
|
|
||||||
MODELS = [Location, Operator, CachedSync, EncryptedProxy]
|
|
||||||
else:
|
|
||||||
logger.error(f"[MIGRATION] Huge issue with loading the tables via Session management. Trying again within migrations")
|
|
||||||
try:
|
try:
|
||||||
from core.models.orm_models.Location import Location
|
from core.models.orm_models.Location import Location
|
||||||
from core.models.orm_models.Operator import Operator
|
from core.models.orm_models.Operator import Operator
|
||||||
from core.models.orm_models.CachedSync import CachedSync
|
from core.models.orm_models.CachedSync import CachedSync
|
||||||
from core.models.orm_models.EncryptedProxy import EncryptedProxy
|
from core.models.orm_models.EncryptedProxy import EncryptedProxy
|
||||||
|
MODELS = [Location, Operator, CachedSync, EncryptedProxy]
|
||||||
|
logger.info(f"[MIGRATION] Tables loaded")
|
||||||
except:
|
except:
|
||||||
logger.error(f"[MIGRATION] Second try to load the tables failed.")
|
logger.error(f"[MIGRATION] Could not load models. Critical failure.")
|
||||||
|
|
||||||
changes_made = []
|
changes_made = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue