Skip to content

fix(db): Postgres-valid boolean default — restore prod (v185 migration crash) - #178

Merged
sshlg merged 1 commit into
mainfrom
fix/prod-migration-bool-default-2026-06-26
Jun 26, 2026
Merged

fix(db): Postgres-valid boolean default — restore prod (v185 migration crash)#178
sshlg merged 1 commit into
mainfrom
fix/prod-migration-bool-default-2026-06-26

Conversation

@sshlg

@sshlg sshlg commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

🔴 Production hotfix

R5 migration e909ec65d857 used server_default=sa.text("1") on a Boolean column. SQLite accepts 1 for booleans (all local + CI tests + the alembic SQLite check passed), but Postgres rejects a bare-integer boolean defaultalembic upgrade head failed on web boot → crash-loop → /api/health 503 on release v185.

Fix: server_default=sa.true() (compiles to true on PG, 1 on 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

…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>
@sshlg
sshlg merged commit 2a84b97 into main Jun 26, 2026
@sshlg
sshlg deleted the fix/prod-migration-bool-default-2026-06-26 branch June 26, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant