Alembic construit le moteur directement, sans passer par le fichier ini
build / Garde-fou (pull_request) Successful in 9m29s
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (pull_request) Skipped
build / Images Harbor (web, Dockerfile) (pull_request) Skipped
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (push) Successful in 9m44s
build / Garde-fou (push) Successful in 9m31s
build / Images Harbor (web, Dockerfile) (push) Successful in 13m8s
build / Garde-fou (pull_request) Successful in 9m29s
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (pull_request) Skipped
build / Images Harbor (web, Dockerfile) (pull_request) Skipped
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (push) Successful in 9m44s
build / Garde-fou (push) Successful in 9m31s
build / Images Harbor (web, Dockerfile) (push) Successful in 13m8s
This commit is contained in:
1 parent
5659c32b66
commit
6c602c97ad
3 files changed
+43
-11
No files matched your search
+6
-10
@@ -11,7 +11,7 @@ import os
|
||||
import sys
|
||||
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
from sqlalchemy import create_engine, pool
|
||||
|
||||
sys.path.insert(0, os.getcwd())
|
||||
|
||||
@@ -19,15 +19,15 @@ from enclume.config import Config
|
||||
from enclume.db import Base
|
||||
|
||||
config = context.config
|
||||
# Une seule source de verite pour l'URL : celle de l'application, qui sait
|
||||
# assembler les elements separes et encoder le mot de passe.
|
||||
config.set_main_option("sqlalchemy.url", Config.SQLALCHEMY_DATABASE_URI)
|
||||
# L'URL n'est jamais passee par le fichier ini : configparser y verrait des
|
||||
# interpolations, et un mot de passe encode contient des %.
|
||||
URL = Config.SQLALCHEMY_DATABASE_URI
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
def run_migrations_offline() -> None:
|
||||
context.configure(
|
||||
url=config.get_main_option("sqlalchemy.url"),
|
||||
url=URL,
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
@@ -37,11 +37,7 @@ def run_migrations_offline() -> None:
|
||||
|
||||
|
||||
def run_migrations_online() -> None:
|
||||
connectable = engine_from_config(
|
||||
config.get_section(config.config_ini_section, {}),
|
||||
prefix="sqlalchemy.",
|
||||
poolclass=pool.NullPool,
|
||||
)
|
||||
connectable = create_engine(URL, poolclass=pool.NullPool)
|
||||
with connectable.connect() as connection:
|
||||
context.configure(connection=connection, target_metadata=target_metadata)
|
||||
with context.begin_transaction():
|
||||
|
||||
Reference in new issue
Block a user