Checklist
Write invariants before the migration
A migration can be perfectly formatted and completely wrong.
Before you use it
- Use when
- A transformation can produce syntactically valid output while breaking business rules.
Keep this limit in mind
- Missing invariants create false confidence; involve domain owners where correctness depends on rules the implementation team may not know.
An idea to explore.
Try this idea.
Inspect the example, try the idea in your situation, then check your next move.
Checklist
- Each invariant states what must remain true, not how the script happens to work.
- The invariant can be checked automatically or with a defined inspection method.
- Pre-change baseline values are captured when comparison matters.
- Staged output is checked before commit.
- Authoritative post-change state is checked again.
Why it matters
Before running the change, write the properties that must remain true across it: uniqueness, required relationships, totals, allowed status transitions, referential links, permission boundaries or another domain invariant. Validate them on staged output and again after application. Prefer checks that fail loudly over manual visual confidence.
An example
A business-partner migration may require every active sales-area assignment to keep exactly one valid partner role mapping.
Check your result
A technically successful transformation still fails the gate when a declared business invariant is violated.
Save and practise this idea
My learning
Read. Recall. Repeat.
Save this idea and return to it on any device.
Keep exploring
Connected ideas
You are readingWrite invariants before the migration
Evidence and sources
Google SRE's two-phase mutation pattern explicitly separates generating candidate changes from validating their correctness before applying them.
Validation rules must encode the invariants that actually matter; a passing schema check can still permit a semantically wrong change.
Improve and Optimize Data Processing Pipelines · Two-Phase Mutations
All sources (1)
Edition and review
Version 0.1.0
No review details are supplied for this edition.