chore(api): fix Alembic offline migration compatibility (#24795)

This PR fixes Alembic offline mode (`--sql` flag) by ensuring data migration functions only execute in online mode. When running in offline mode, these functions now skip data operations and output informational comments to the generated SQL.
This commit is contained in:
QuantumGhost
2025-08-29 19:13:24 +08:00
committed by GitHub
parent 3787c824b2
commit 3ac2f8fbcd
3 changed files with 47 additions and 8 deletions
+6
View File
@@ -34,6 +34,12 @@ jobs:
- name: Install dependencies
run: uv sync --project api
- name: Ensure Offline migration are supported
run: |
# upgrade
uv run --directory api flask db upgrade 'base:head' --sql
# downgrade
uv run --directory api flask db downgrade 'head:base' --sql
- name: Prepare middleware env
run: |