bcquality/microsoft/knowledge/upgrade/minimize-onvalidate-upgrade-triggers.md
Jesper Schulz-Wedde e0ebdd35c7
Add lifecycle error and privacy knowledge (#99)
* Add lifecycle error and privacy knowledge

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

* Fix lifecycle privacy review findings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a26cd6d6-ff49-433e-bc53-f645c455ebdd

* Refine lifecycle privacy retrieval

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

* Make review gates explicit

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-14 12:52:56 +02:00

1.1 KiB

bc-version domain keywords technologies countries application-area
all
upgrade
on-validate-upgrade-per-company
performance-impact
bounded-query
justification
read-only-check
al
w1
all

Keep upgrade validation checks bounded

Description

Triggers such as OnValidateUpgradePerCompany run on every upgrade pass. A full-table scan or cross-table validation therefore adds cost to every upgrade of every tenant. Validation is a read-only lifecycle check, so it cannot make itself one-time by writing an upgrade tag.

Best Practice

Filter directly to invalid rows and use IsEmpty or another bounded existence check where possible. If a broad validation is unavoidable, document the invariant that requires it and keep all data changes in OnUpgrade....

See sample: minimize-onvalidate-upgrade-triggers.good.al.

Anti Pattern

Reading every record in OnValidateUpgradePerCompany when a filtered existence check can prove the same invariant. The scan repeats on every upgrade.

See sample: minimize-onvalidate-upgrade-triggers.bad.al.