Skip to content

BDMS-540: Link NMA_SurfaceWaterPhotos to NMA_SurfaceWaterData#469

Merged
jirhiker merged 5 commits intokas-bdms-540-NMA_WeatherData-FK-relationshipfrom
kas-bdms-540-NMA_SurfaceWaterPhotos-FK-relationship
Feb 7, 2026
Merged

BDMS-540: Link NMA_SurfaceWaterPhotos to NMA_SurfaceWaterData#469
jirhiker merged 5 commits intokas-bdms-540-NMA_WeatherData-FK-relationshipfrom
kas-bdms-540-NMA_SurfaceWaterPhotos-FK-relationship

Conversation

@ksmuczynski
Copy link
Copy Markdown
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 and others added 2 commits February 5, 2026 16:40
…NMA_WeatherPhotos via WeatherID

- move weather_id under FK section and enforce NOT NULL
- add FK + relationship + validator on NMA_WeatherPhotos
- mark NMA_WeatherData.weather_id unique for FK target
- run WeatherPhotos transfer after WeatherData and skip orphan photos
- add migration to backfill/cleanup and enforce FK/NOT NULL
- update legacy tests to create WeatherPhotos with a real parent WeatherData
@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
Copy Markdown
Member

jirhiker commented Feb 6, 2026

See comment on PR#470

…atherPhotos-FK-relationship

BDMS-540: Link NMA_WeatherPhotos to NMA_WeatherData
@jirhiker jirhiker merged commit 393c553 into kas-bdms-540-NMA_WeatherData-FK-relationship Feb 7, 2026
4 checks passed
@TylerAdamMartinez TylerAdamMartinez deleted the kas-bdms-540-NMA_SurfaceWaterPhotos-FK-relationship branch March 12, 2026 17:16
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