feat: add board_note_id FK to board_items + data migration #207
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!207
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "196-board-note-id-fk"
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
board_note_idFK column onboard_itemspointing tonotes.id, enabling transition from board-centric to note-centric kanbannote_type="board"notes for all 13 existing boards and backfills the new FKboard_idandboard_note_idremain valid during transitionChanges
alembic/versions/q7l8m9n0o1p2_add_board_note_id_to_board_items.py— Alembic migration addingboard_note_idcolumn, index, and FK constraint toboard_itemssrc/pal_e_docs/models.py— Addedboard_note_idmapped column andboard_noterelationship toBoardItemscripts/migrate_boards_to_notes.py— Idempotent data migration script that creates board notes, maps board.id to note.id, and backfillsboard_note_idon all board_itemsTest Plan
alembic upgrade headpython /tmp/migrate_boards_to_notes.pyReview Checklist
Related
QA Review -- PR #207
Alembic Migration (
q7l8m9n0o1p2)p6k7l8m9n0o1(latest head)fk_board_items_board_note_idis explicit, which is good for Postgres (production target)Model Changes (
models.py)board_note_idcolumn: nullable FK tonotes.id, indexed -- matches migrationboard_noterelationship: uses explicitforeign_keys=[board_note_id]to avoid ambiguity with existing Note FKs -- correctback_populateson Note side -- appropriate since reverse navigation is not needed yetboard_idFK untouched -- dual FK period as specifiedBoardItemOut,BoardItemCreate) not modified -- correct per scope (#197 owns API changes)Data Migration Script (
scripts/migrate_boards_to_notes.py)session.flush()to get note IDs before backfilling items -- correctsys.path.insertpattern matches existingbackfill_blocks.pyconventionTest Results
Scope Compliance
routes/boards.py(deferred to #197)board_id(deferred to #199)No Issues Found
VERDICT: APPROVE