Fix Alembic migration drift (blocks CI build-and-push) #176
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-api#176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
incident-paledocs-alembic-drift-2026-03-14— discovered duringplan-pal-e-platform→ Phase 7aRepo
forgejo_admin/pal-e-docsUser Story
As a platform operator
I want
alembic checkto pass in CISo that the build-and-push step runs and new images deploy automatically
Context
The CI migration-test step runs
alembic upgrade headthenalembic check. The upgrade succeeds butalembic checkdetects model-vs-DB drift and exits with code -1 (255 unsigned). This blocks the build-and-push step, preventing any automated deploys.The drift was discovered by querying the Woodpecker
log_entriestable directly (Woodpecker log API returns empty — separate issue). The specific drift items detected byalembic check:modify_nullableonblocks.created_at,blocks.updated_at(models say NOT NULL, DB allows NULL)modify_nullableonboard_items.created_at,board_items.updated_atmodify_nullableonboards.created_at,boards.updated_atmodify_nullableoncompiled_pages.html,compiled_pages.compiled_atremove_index ix_board_items_board_column(index exists in DB but not in models)remove_constraint boards_slug_key+ changeix_boards_slugunique flagremove_index ix_notes_parent_note_id_position(index exists in DB but not in models)remove_index ix_notes_search_vector(index exists in DB but not in models)remove_column notes.search_vector(column exists in DB but not in models)File Targets
Files to create:
alembic/versions/XXXX_fix_schema_drift.py— new migration that resolves ALL drift itemsFiles NOT to touch:
src/pal_e_docs/models.py— models are correct, DB needs to match themAcceptance Criteria
alembic upgrade headsucceeds on a fresh Postgres DB with pgvectoralembic checkpasses with no detected drift after upgradeTest Expectations
PALDOCS_DATABASE_URL=postgresql+psycopg2://postgres:postgres@localhost:5432/paledocs_test alembic upgrade head && alembic checkalembic upgrade head && alembic checkConstraints
server_default=func.now()for nullable→NOT NULL timestamp conversions (backfill existing NULLs first)notes.search_vectorcolumn removal must handle the case where it doesn't exist (idempotent)Checklist
Related
incident-paledocs-alembic-drift-2026-03-14— the incident this fixesplan-pal-e-platform— Phase 7a blocked on this