Harden anchor_id column to NOT NULL #127
No reviewers
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!127
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "124-anchor-id-not-null"
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?
Summary
Applies a NOT NULL constraint to the
anchor_idcolumn on theblockstable, hardening the DB schema to match the application-level invariant that all blocks have non-null anchor_ids.Changes
src/pal_e_docs/models.py: Changedanchor_idfromMapped[str | None]/nullable=TruetoMapped[str]/nullable=Falsealembic/versions/m3h4i5j6k7l8_anchor_id_not_null.py: New migration that first verifies zero NULL anchor_ids exist (fails loudly if any found), then appliesALTER COLUMN anchor_id SET NOT NULL. Downgrade reverts to nullable. Depends onl2g3h4i5j6k7(vector embeddings), which itself depends onk1f2g3h4i5j6(the backfill + unique constraint from PR #120).tests/test_blocks_compiled_pages.py: Fixed two test helpers that created Block instances withoutanchor_id-- now provide explicit values.Test Plan
Review Checklist
Related
todo-anchor-id-not-null(traceability)