Move schema evolution to Alembic with auto-upgrade on API start.

Extract shared brownfield patches, add the legacy revision, and default to upgrade-head plus skip of duplicate inline DDL (with legacy fallback if Alembic fails).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-02 16:41:56 +08:00
parent 6e8003be5c
commit 57b3faf9fb
8 changed files with 503 additions and 343 deletions

View file

@ -50,7 +50,9 @@ NETX_UME_NOTIFICATION_TOPIC=ALARM
# API docs (/docs, /redoc, /openapi.json); default false. Lab: set true.
# NETX_DOCS_ENABLED=true
# NETX_ALLOW_INSECURE_DEFAULTS=false
# NETX_SKIP_LEGACY_STARTUP_DDL=true
# Schema: Alembic auto-upgrades on API start (defaults on). Override only if needed:
# NETX_ALEMBIC_UPGRADE_ON_START=false
# NETX_SKIP_LEGACY_STARTUP_DDL=false
# NETX_SQL_READONLY_DATABASE_URL=postgresql+psycopg://netx_ro:xxx@127.0.0.1:5432/netx
# NETX_RUN_INLINE_SCHEDULERS=true
# NETX_AUDIT_ASYNC=true