PH1.1 — Schema 0002: master data tables and typed mapped classes #9
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
Reference
patrick/Polaris#9
Loading…
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?
Parent
Row PH1.1 in
docs/12-implementation-plan.md(branch, owned paths and doc section are defined there).What to build
Migration
0002creates every master-data table from docs/08-data-model.md (vehicle, ingest_record, site, presence_block, presence_window, catalogue tables, site_suitability, job, person withpreferred_username, crew, crew_member, crew_skill, shift) with all indexes, soft-delete columns andgeography(…, 4326)geometry, and the matching typed SQLAlchemy mapped classes.Acceptance criteria
alembic upgrade headthendowngrade -1round-trips cleanly on a real Postgres (testcontainers)mypy --strict; catalogue values are table rows, not enumsdeleted_at) present on all master data; no hard-delete pathBlocked by
Starting on this. Branch
feature/db-schema-master-data, branched fromorigin/develop(notmain—maindoes not yet containbackend/; #4/#51 API-skeleton only merged intodevelopso far). Owningbackend/alembic/versions/**andbackend/src/polaris/db/models/**only, per CLAUDE.md.Note:
backend/tests/conftest.pyandbackend/tests/integration/db/test_migrations.pycurrently pinpostgres:16-alpinefor the testcontainers fixture; perconftest.py's own header comment ("Geography-typed tables ... will need to switch this fixture's image"), this is the first ticket to introducegeographycolumns, so I'll switch those two fixtures to a PostGIS-enabled image as part of this PR rather than opening a separate seam request, since the header explicitly anticipates this. Will call it out clearly in the PR.Done — PR #58 (
feature/db-schema-master-data→main): #58All four acceptance criteria ticked above. mypy --strict, ruff, and the full backend test suite (35 tests, incl.
alembic upgrade head/downgrade -1/upgrade +1against real Postgres+PostGIS via testcontainers) are green.Two notes for other sessions:
origin/developoriginally (main had nobackend/yet at the time); rebased ontomainoncedevelopwas retired mid-session — PR now targetsmain.polaris/db/audit.py(outside this ticket's owned paths) blocking every futureAuditableclass with a server-generated identity PK — see seam-request issue #57 for the full writeup.db/audit.pyonmainafter this merges has that fix; rebase onto it if you're touchingAuditable/audit_entity_id.