Skip to content

BDMS-540: Link NMA_SurfaceWaterPhotos to NMA_SurfaceWaterData#469

Open
ksmuczynski wants to merge 2 commits intokas-bdms-540-NMA_WeatherData-FK-relationshipfrom
kas-bdms-540-NMA_SurfaceWaterPhotos-FK-relationship
Open

BDMS-540: Link NMA_SurfaceWaterPhotos to NMA_SurfaceWaterData#469
ksmuczynski wants to merge 2 commits intokas-bdms-540-NMA_WeatherData-FK-relationshipfrom
kas-bdms-540-NMA_SurfaceWaterPhotos-FK-relationship

Conversation

@ksmuczynski
Copy link
Contributor

@ksmuczynski ksmuczynski commented Feb 5, 2026

Why

This PR addresses the following problem / context:

  • NMA_SurfaceWaterPhotos lacked a direct FK relationship to SurfaceWaterData, making joins and integrity checks harder.

How

Implementation summary - the following was changed / added / removed:

  • Adds a SurfaceID FK relationship between NMA_SurfaceWaterPhotos and NMA_SurfaceWaterData.
  • Updates the surface water photo transfer to use the new relationship and aligns transfer helpers.
  • Extends legacy surface water photo tests to cover the SurfaceID relationship.
  • Adds the Alembic migration to create the FK and supporting uniqueness constraint.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • !! This is the base for a forthcoming PR. To maintain Alembic migration linearity, please ensure this branch is not deleted upon merging.

…os and NMA_SurfaceWaterData via SurfaceID

- make NMA_SurfaceWaterData.surface_id unique to support FK target
- add FK + relationship on NMA_SurfaceWaterPhotos.surface_id with validation
- enforce parent-first ordering by running SurfaceWaterPhotos after SurfaceWaterData
- skip orphan photo rows in transfer using cached SurfaceIDs
- add migration to backfill/cleanup and enforce NOT NULL + FK
- update legacy tests to create photos with real parent SurfaceWaterData
@ksmuczynski ksmuczynski changed the title BDMS-540: Link SurfaceWaterPhotos to SurfaceWaterData BDMS-540: Link NMA_SurfaceWaterPhotos to NMA_SurfaceWaterData Feb 5, 2026
@jirhiker
Copy link
Member

jirhiker commented Feb 6, 2026

See comment on PR#470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants