aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/migrations/env.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-27 23:16:27 +0100
committerDennis Fink2026-10-27 23:18:45 +0100
commit17ab56a3c7d3dbb3d66edf380ab637a61cefe50c (patch)
tree1626e3e1d402a6614a1cec4c2c6719d301f39bac /webmentions_ssg/migrations/env.py
parent5afb245d13b91047d68d7b7343245c41b6460953 (diff)
downloadwebmentions-ssg-17ab56a3c7d3dbb3d66edf380ab637a61cefe50c.tar.gz
webmentions-ssg-17ab56a3c7d3dbb3d66edf380ab637a61cefe50c.zip
feat(core): add database CLI
Make database initialization and upgrades explicit so new installations cannot silently modify an existing or unversioned schema. Keep Flask-Migrate commands available separately and package the migration environment with the application for reliable deployment.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/migrations/env.py (renamed from migrations/env.py)14
1 files changed, 4 insertions, 10 deletions
diff --git a/migrations/env.py b/webmentions_ssg/migrations/env.py
index fa912c3..e2e0ec9 100644
--- a/migrations/env.py
+++ b/webmentions_ssg/migrations/env.py
@@ -3,7 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
import logging
-from logging.config import fileConfig
from alembic import context
from flask import current_app
@@ -12,19 +11,14 @@ from flask import current_app
# access to the values within the .ini file in use.
config = context.config
-# Interpret the config file for Python logging.
-# This line sets up loggers basically.
-fileConfig(config.config_file_name)
+# Flask already configures application logging.
+# Do not let Alembic replace existing logging handlers,
+# including pytest's log capture handler.
logger = logging.getLogger("alembic.env")
def get_engine():
- try:
- # this works with Flask-SQLAlchemy<3 and Alchemical
- return current_app.extensions["migrate"].db.get_engine()
- except TypeError, AttributeError:
- # this works with Flask-SQLAlchemy>=3
- return current_app.extensions["migrate"].db.engine
+ return current_app.extensions["migrate"].db.engine
def get_engine_url():