feat: add custom_notes column to players table #165
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/basketball-api!165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "19-add-custom-notes-to-player"
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
custom_notesText column to theplayerstableChanges
alembic/versions/020_add_custom_notes_to_player.py: new migration addingcustom_notescolumn (Text, nullable)src/basketball_api/models.py: addedcustom_notesfield toPlayermodelTest Plan
custom_notescolumn exists onplayerstable after migrationReview Checklist
Related
Review: LGTM
Migration 020: Correct
down_revision, cleanupgrade/downgradewithsa.Text()nullable. Matches the model exactly.Model:
custom_notesfield placed logically beforecreated_at, uses already-importedTexttype.Note: Migration must be applied manually against the live DB before the companion westside-contracts PR will have any effect.
PR #165 Review
DOMAIN REVIEW
Tech stack: Python / FastAPI / SQLAlchemy / Alembic
Migration (
alembic/versions/020_add_custom_notes_to_player.py)add_column/drop_columnpair. Reversible. Correct use ofsa.Text()andnullable=True.Textis already imported inmodels.py(line 12), so no import change needed for the model -- correct.NNN_description.py) consistent with 001-018.Model (
src/basketball_api/models.py)Mapped[str | None]withmapped_column(Text, nullable=True)-- correct SQLAlchemy 2.0 pattern matching all other nullable fields on Player (e.g.,jersey_number,contract_version).jersey_numberandcreated_atis reasonable.SELECT p.*.Security
custom_noteswould go through admin scripts or direct DB (admin-only). No new endpoint accepts user input for this field.custom_notesis rendered via Svelte{expression}syntax which is HTML-escaped by default. No XSS risk.BLOCKERS
1. Migration 020 depends on unmerged migration 019 (PR #164)
020_add_custom_notes_to_player.pydeclaresdown_revision = "019", but migration 019 (019_player_teams_junction.py) only exists in PR #164 (many-to-many junction table), which has not been merged tomain. Runningalembic upgrade headagainst currentmain+ this PR will fail with:This PR must not merge before PR #164. The dependency should be documented in the PR body under Related.
No other blockers. The "new functionality with zero test coverage" criterion does not apply here -- this PR adds a nullable column with no business logic, no endpoints, and no validation in basketball-api. The column is a passive data field consumed by the companion westside-contracts app.
NITS
PR body should declare the dependency on PR #164 -- Add something like
Depends-on: #164 (migration 019)to the Related section. This is important for merge ordering.Cross-repo breakage risk (informational): The westside-contracts companion query uses
LEFT JOIN teams t ON t.id = p.team_id, but PR #164 drops theteam_idcolumn fromplayersin favor of a junction table. When PR #164 merges, the westside-contracts query will break. This is out of scope for this PR, but should be tracked as a follow-up issue on westside-contracts.No test for custom_notes round-trip: While not a blocker (no logic to test), a one-line assertion in an existing Player fixture confirming the column serializes to
Noneby default would be cheap insurance against model/migration drift.SOP COMPLIANCE
19-add-custom-notes-to-playermatches westside-contracts#19PROCESS OBSERVATIONS
LEFT JOIN teams t ON t.id = p.team_id) will break once PR #164 (junction table) merges. A westside-contracts issue should track updating that query to use the junction table.VERDICT: NOT APPROVED
Single reason: migration 020 references
down_revision = "019"which does not exist onmain. This will causealembic upgrade headto fail. Document the dependency on PR #164 in the Related section, and ensure PR #164 merges first. Once that dependency is acknowledged and the merge order is locked in, this PR is clean and ready.