fix(db): Postgres-valid boolean default — restore prod (v185 migration crash) - #178
Merged
Merged
Conversation
…tgres-valid; fixes prod v185 migration crash
R5 migration e909ec65d857 used server_default=sa.text('1') on a Boolean column.
SQLite accepts 1 for booleans (all local/CI tests passed) but Postgres rejects a
bare integer boolean default (DatatypeMismatchError), so 'alembic upgrade head'
failed on web boot → crash-loop → /api/health 503. Fix: sa.true() (compiles to
'true' on PG, '1' on SQLite) in the migration + the model; add a regression guard
that fails on any bare-integer Boolean server_default compiled for the PG dialect.
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
🔴 Production hotfix
R5 migration
e909ec65d857usedserver_default=sa.text("1")on a Boolean column. SQLite accepts1for booleans (all local + CI tests + the alembic SQLite check passed), but Postgres rejects a bare-integer boolean default →alembic upgrade headfailed on web boot → crash-loop →/api/health503 on release v185.Fix:
server_default=sa.true()(compiles totrueon PG,1on SQLite) in the migration and the model; plus a regression guard (test_boolean_server_defaults_pg.py) that fails on any bare-integer Boolean default compiled for the PG dialect.Verified: dialect compiler (PG→
true, SQLite→1), SQLite alembic up/down/base clean, guard + connection + alembic tests green, ruff/mypy clean. Spec:docs/superpowers/specs/2026-06-26-prod-migration-boolean-default-hotfix-design.md.Process follow-up (separate): run migrations against a Postgres service in CI.
🤖 Generated with Claude Code