Upgrade check triggers do not migrate data
OnCheckPreconditionsPerCompany/PerDatabase run before the upgrade to verify that it can start. OnValidateUpgradePerCompany/PerDatabase run after upgrade logic to verify that it succeeded. Treat both phases as read-only checks.
- microsoftlayer
- upgradedomain
- 2examples
- 2pull requests
Rule on GitHub · microsoft layer · upgrade · BC all · tier official · derived
Description
OnCheckPreconditionsPerCompany/PerDatabase run before the upgrade to verify that it can start. OnValidateUpgradePerCompany/PerDatabase run after upgrade logic to verify that it succeeded. Treat both phases as read-only checks. The OnUpgradePerCompany/PerDatabase phase is where the platform expects actual data transformation.
Best Practice
Have check triggers call query-only helpers that raise an error when an invariant fails. Put every Insert, Modify, Delete, Rename, DataTransfer, and other migration write behind helpers called from the matching OnUpgrade... trigger.
See sample: check-only-triggers-do-not-migrate-data.good.al.
Anti Pattern
Repairing data in OnCheckPreconditions... or finishing migration in OnValidateUpgrade.... Those writes blur the phase contract and make a check alter the state it is supposed to assess.
See sample: check-only-triggers-do-not-migrate-data.bad.al.
Examples
- Good: check-only-triggers-do-not-migrate-data.good.al
- Bad: check-only-triggers-do-not-migrate-data.bad.al
Changed by
- #174 Make BCQuality documentation easier for partners to get started, 2026-09-09
- #99 Add lifecycle error and privacy knowledge, 2026-07-14
From microsoft/BCQuality at a4593a1, MIT License, Copyright (c) 2026 Microsoft Corporation (license).