mirror of
https://github.com/reconurge/flowsint.git
synced 2026-03-11 17:34:31 -05:00
feat: remove env.py comments
This commit is contained in:
@@ -6,27 +6,21 @@ from sqlalchemy import engine_from_config, pool
|
||||
from alembic import context
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Charger les variables d'environnement
|
||||
load_dotenv()
|
||||
|
||||
# Permet les imports comme from flowsint_core.core.models.base import Base
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
# Importer Base et toutes les tables pour qu'Alembic les détecte
|
||||
from flowsint_core.core.models import * # noqa
|
||||
|
||||
# Configuration Alembic
|
||||
config = context.config
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
|
||||
# Injecter l'URL de la BDD depuis le .env
|
||||
database_url = os.getenv("DATABASE_URL")
|
||||
if not database_url:
|
||||
raise RuntimeError("DATABASE_URL is not defined in .env")
|
||||
config.set_main_option("sqlalchemy.url", database_url)
|
||||
|
||||
# Définir la métadonnée cible pour autogenerate
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user