refactor(backend): solve copilot comments

This commit is contained in:
2025-09-24 20:12:45 +02:00
parent f4892a69d5
commit 106497e791
2 changed files with 2 additions and 4 deletions

View File

@@ -1 +0,0 @@
Generic single-database configuration.

View File

@@ -4,7 +4,7 @@ from logging.config import fileConfig
from sqlalchemy import pool, create_engine
from alembic import context
# Přidání backend do sys.path pro správný import
# Add path for correct loading of modules
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from app.core.db import Base
@@ -16,7 +16,6 @@ target_metadata = Base.metadata
DATABASE_URL = os.getenv("DATABASE_URL")
if not DATABASE_URL:
# fallback na synchronní url pro Alembic (používá sync driver)
mariadb_host = os.getenv("MARIADB_HOST", "localhost")
mariadb_port = os.getenv("MARIADB_PORT", "3306")
mariadb_db = os.getenv("MARIADB_DB", "group_project")
@@ -24,7 +23,7 @@ if not DATABASE_URL:
mariadb_password = os.getenv("MARIADB_PASSWORD", "strongpassword")
DATABASE_URL = f"mysql+pymysql://{mariadb_user}:{mariadb_password}@{mariadb_host}:{mariadb_port}/{mariadb_db}"
# Vždy používej synchronní engine pro migrace
# Use synchronous driver for Alembic migrations
SYNC_DATABASE_URL = DATABASE_URL.replace("+asyncmy", "+pymysql")