Skip to content

feat: add unique constraints for NMA_WaterLevelsContinuous_Pressure_Daily and NGWMN tables#341

Merged
jirhiker merged 1 commit into
stagingfrom
migration/waterlevels-continuous-pressure-daily
Jan 7, 2026
Merged

feat: add unique constraints for NMA_WaterLevelsContinuous_Pressure_Daily and NGWMN tables#341
jirhiker merged 1 commit into
stagingfrom
migration/waterlevels-continuous-pressure-daily

Conversation

@jirhiker

@jirhiker jirhiker commented Jan 7, 2026

Copy link
Copy Markdown
Member

Why

This PR addresses the following problem / context:

  • Use bullet points here

How

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

  • Use bullet points here

Notes

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

  • Use bullet points here

@jirhiker jirhiker merged commit 5bd8dea into staging Jan 7, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08b990d899

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +68 to +79
def downgrade() -> None:
"""Drop the NGWMN unique constraints if they exist."""
op.execute(
"""
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM pg_constraint WHERE conname = 'uq_nma_view_ngwmn_waterlevels_point_date'
) THEN
ALTER TABLE "NMA_view_NGWMN_WaterLevels"
DROP CONSTRAINT uq_nma_view_ngwmn_waterlevels_point_date;
END IF;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep NGWMN constraints when downgrading 5f4e2b0a6b8b

The downgrade here drops the NGWMN unique constraints even though they are originally introduced in an earlier migration (8a1de3e3f0b3). If someone downgrades from 5f4e2b0a6b8b to 4b7aa74b15ad, Alembic will run this block and remove constraints that should still exist at that revision, which can break the ON CONFLICT upserts for NGWMN backfills. Since this migration’s upgrade is only a conditional “ensure,” its downgrade should be a no-op (or only revert changes it made) to avoid leaving the schema in an invalid historical state.

Useful? React with 👍 / 👎.

@TylerAdamMartinez TylerAdamMartinez deleted the migration/waterlevels-continuous-pressure-daily branch February 26, 2026 18:27
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.

1 participant