Open
Conversation
When get_settings() throws (e.g. missing REDIS_URL), get_url() silently returns the alembic.ini fallback URL (SQLite) and get_schema() silently returns None. This causes migrations to run against SQLite instead of the configured Postgres database with no indication anything went wrong. Add warning-level logging with exc_info to both get_url() and get_schema() so the root cause is visible when the fallback triggers. Also document the known Alembic <=1.18 limitation where depends_on cross-location references cause RevisionError on "upgrade heads". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
get_settings()throws an exception inalembic/env.py(e.g. missingREDIS_URLor other env vars),get_url()silently falls back to thealembic.inidefault (sqlite+aiosqlite:///./app.db) andget_schema()silently returnsNone. Migrations then run against SQLite instead of the configured Postgres database with zero warning.logger.warning(..., exc_info=True)to bothget_url()andget_schema()exception handlers so the fallback is visible and the root cause exception is logged.depends_oncross-location references causeRevisionError: Requested revision X overlaps with other requested revisions Ywhen runningupgrade heads.Test plan
skrift db upgrade headsworks as before (no warnings emitted)REDIS_URL), the warning is now logged to stderr before the fallback URL is usedexc_info=True)🤖 Generated with Claude Code