Repository navigation
chore(api): fix Alembic offline migration compatibility - #24795
Merged
QuantumGhost merged 3 commits intoAug 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes Alembic offline migration compatibility by preventing data migration functions from executing when running in offline mode (--sql flag). Instead of attempting database operations that would fail in offline mode, the migrations now output informational SQL comments instructing users to manually run the data migration functions.
- Added offline mode detection using
context.is_offline_mode()to skip data migrations - Added informational SQL comments in offline mode to guide manual data migration
- Added CI test to verify offline migration compatibility for both upgrade and downgrade operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/migrations/versions/2025_08_13_1605-0e154742a5fa_add_provider_model_multi_credential.py | Added offline mode checks and informational comments for data migration functions |
| api/migrations/versions/2025_08_09_1553-e8446f481c1e_add_provider_credential_pool_support.py | Added offline mode checks and informational comments for data migration functions |
| .github/workflows/db-migration-test.yml | Added CI test to verify offline migration compatibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
QuantumGhost
marked this pull request as ready for review
August 29, 2025 10:28
crazywoola
approved these changes
Aug 29, 2025
Cluas
pushed a commit
to Cluas/dify
that referenced
this pull request
Sep 1, 2025
…4795) 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.
6 tasks done
Ssazurov
pushed a commit
to Ssazurov/dify
that referenced
this pull request
Aug 8, 2026
…4795) 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes Alembic offline mode (
--sqlflag) 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.Fixes #24794.
Screenshots
N/A
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods