Skip to content

[8.0] Fix precision-only numeric migration snapshot churn - #4068

Merged
roji merged 1 commit into
hotfix/8.0.12from
roji-decimal-precision-backport-8-0
Oct 21, 2026
Merged

roji merged 1 commit into
hotfix/8.0.12from
roji-decimal-precision-backport-8-0

Conversation

@roji

@roji roji commented Oct 21, 2026

Copy link
Copy Markdown
Member

Backports the final net diff of #4065 (source head 820a86955abaa7cfca27526fbdc8bbe168531cc6) to hotfix/8.0.12 for #3521. The source PR is currently open and unmerged.

For precision-only numeric properties, snapshots currently store an inferred numeric(p) column type that reloads as numeric(p,0), causing false model differences and repeated migrations. Omit only this inferred annotation so the existing HasPrecision(p) reconstructs the original mapping. Explicit column types and scales remain unchanged.

Backport safety: Low risk: the production change is confined to the existing design-time property annotation generator. Runtime type mappings, generated SQL, dependencies, and public APIs are untouched. EF Core 8.0.32's snapshot generator uses the same hook and emits HasPrecision(p) separately. Existing affected snapshots require one regeneration; this does not retroactively rewrite them.

Validation: Used the branch-selected .NET 8.0.425 SDK and unchanged pinned dependencies. The new precision-only regression failed before the fix; afterward all 27 NpgsqlAnnotationCodeGeneratorTest cases passed, including explicit column types and scales. No API adaptations were necessary.

Fixes #3521.

Backport the final net diff of #4065 (820a869) for #3521. Omit only inferred precision-only numeric column types during snapshot generation; leave explicit types, scales, and runtime mappings unchanged.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 12f9ca8d-c1bf-46b0-bb94-40fe18290c21
@roji
roji merged commit 258437c into hotfix/8.0.12 Oct 21, 2026
8 checks passed
@roji
roji deleted the roji-decimal-precision-backport-8-0 branch October 21, 2026 15:54
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.

PrecisionAttribute on Decimal parameter causes false positive for PendingModelChangesWarning exception

1 participant