~/qa-guides

~/qa-guides/data-migration-testing-checklist

>_ Data Migration Testing Checklist

Both systems report 100 orders. Find which order went missing, which customer would see the wrong purchase, and what evidence clears the store for cutover.

Data migrationData reconciliationSQL testingRelease readiness

Published

Short answer

A data migration testing checklist helps a team decide whether people can start using the new system with their existing data. Compare the same population at the same committed point in time. Check which business records arrived, who owns them, how their values were transformed, and whether changes made during the copy reached the target exactly as expected.

Imagine moving one store's order history. The old and new systems both report 100 orders. One buyer's purchase is missing, another order appears twice, and a third order belongs to the wrong customer. The checks below find all three defects and give the release owner a way to verify the repair before switching traffic.

Pre-migration checklist

  • Define the population. Record the store, included tables, filters, and exceptions. If archived orders stay behind, count them separately and keep one example that should still open in the archive.
  • Choose a comparison key. Pick an identifier that both sides can trace. Measure missing and repeated keys in the source before treating it as the reference. If order numbers restart for each store, include the store in every match.
  • Agree on field conversions. Have the data owner specify the target meaning of amounts, timestamps, statuses, and empty values. Try a value near the target field's precision or length limit and inspect what is actually stored.
  • Verify the parent mapping. Identify how a source customer maps to a target customer. Include two customers with distinct order histories so a mistaken assignment produces a visible difference.
  • Fix the comparison point. Record the source snapshot and the last committed change it includes. Keep a consistent target extract for that point. Comparing yesterday's copy with today's live source can make a new order look lost.
  • Set the acceptance and recovery rules. Name the person who can hold the switch, the discrepancies that require a hold, and the time available to reconcile. Rehearse the full load and final checks against representative volumes to see whether they fit that window.

If a CSV file carries part of the migration, test how the importer treats its headers, quoted fields, and rejected rows using the CSV import testing checklist. Preserve the accepted batch identifier so you can trace a saved order back to that input.

Build a 100-order rehearsal with a known answer

This example moves one store's order headers. Each source order must produce one target order with the same business key, customer, currency, and amount. The target assigns its own internal IDs. All keys, customer references, currency codes, and amounts in the example are required. The source contains no rejected or excluded rows. The first consistent snapshot includes all committed changes through position 7000.

Create orders O-001 through O-100. Odd-numbered orders belong to C-B and use USD. Even-numbered orders belong to C-A and use EUR. The first 98 orders are worth 1000 cents each. The last two are worth 2400 cents each. Each currency therefore has 50 orders and a total of 49 * 1000 + 2400 = 51400 cents. In the verified customer mapping, target customer 51 represents C-A and target customer 73 represents C-B.

Run the read-only SQL examples in a workspace that can query both extracts. In the examples, source_orders exposes order_key, customer_key, currency, and cents. target_orders exposes target_id, order_key, customer_id, currency, and cents. The independent customer_map exposes target_id and customer_key. All three are scoped to the test store. Teams with separate database engines can export those columns into the same comparison workspace.

Reconcile the full load

To reproduce the faulty load, copy O-001 through O-098 once and O-100 twice. Give each copy a new target ID. Apply the verified customer mapping to every order except O-042, which goes to customer 73 in this run. Keep the original source extract for comparison.

Find a missing order and a duplicate that cancel each other out

Run this query on target_orders, then substitute source_orders to get the reference result.

SELECT COUNT(*) AS row_count, COUNT(order_key) AS with_key, COUNT(DISTINCT order_key) AS distinct_keys FROM target_orders

Both extracts return 100 rows and 100 non-null order keys. The source has 100 distinct business keys. The target has 99. All 100 target rows have different internal IDs. Distinct internal IDs tell you that storage created separate records. The retained order key tells you which purchase each record represents.

List the source keys missing from the target.

SELECT order_key FROM source_orders EXCEPT SELECT order_key FROM target_orders

The result is O-099. Reverse the comparison to find target keys outside the agreed population.

SELECT order_key FROM target_orders EXCEPT SELECT order_key FROM source_orders

The reverse query returns zero rows. EXCEPT compares distinct keys, so a second copy of a known order needs its own check.

SELECT order_key, COUNT(*) AS copies FROM target_orders GROUP BY order_key HAVING COUNT(*) > 1

This query returns O-100 with two copies. A support agent looking up that order could open either target record. Save both target IDs with the defect so the team can inspect any dependent records before repairing it.

Compare totals separately for each currency

Apply the same grouping to both extracts. For these two currencies the stored unit is one cent, and the migration contract preserves it exactly.

SELECT currency, COUNT(*) AS orders, SUM(cents) AS total_cents FROM target_orders GROUP BY currency ORDER BY currency

Each cell below gives the order count followed by the amount in cents.

CurrencySourceTarget
EUR50 / 5140051 / 53800
USD50 / 5140049 / 49000

The USD total is short by 24.00, the amount of O-099. The EUR total is high by 24.00, the amount of the extra O-100. Adding raw cents across currencies would give 102800 on each side and hide both discrepancies. The business has agreed to preserve the original currency on each order, so the test needs a separate expected total for each one.

Verify who can see each order

First look for customer references that cannot be resolved in the target mapping.

SELECT t.order_key FROM target_orders t LEFT JOIN customer_map m ON m.target_id = t.customer_id WHERE m.target_id IS NULL

This check returns zero rows. Every target order points to an existing customer. To find a purchase assigned to the wrong existing customer, translate its target customer ID back to the business key and compare it with the source owner.

SELECT s.order_key, s.customer_key AS expected, m.customer_key AS actual FROM source_orders s JOIN target_orders t ON t.order_key = s.order_key JOIN customer_map m ON m.target_id = t.customer_id WHERE s.customer_key <> m.customer_key

The result is O-042, expected C-A, actual C-B. Its target customer ID is 73. A valid foreign key allowed that assignment. In the customer-facing rehearsal, open order history as both buyers. After the repair, O-042 should appear only in the order history for C-A.

Verify amounts on matched orders after the repair

Record Hold for the first load. Rebuild the rehearsal target from snapshot 7000 with the corrections, retain the failed run's evidence, and repeat the key, currency, and ownership checks. Expect 100 distinct keys across 100 rows, the source totals for both currencies, and zero unresolved or wrong owners.

Then check the currency and amount on each matched order.

SELECT s.order_key FROM source_orders s JOIN target_orders t ON t.order_key = s.order_key WHERE s.currency <> t.currency OR s.cents <> t.cents ORDER BY s.order_key

Try a separate test copy of the repaired load. Swap the amounts on O-002 and O-100. Both are EUR orders, so their count and combined amount still match. The query should return both keys. Run it again on the repaired copy and expect zero rows. This is a way to verify that the check itself can catch a defect the totals miss. Google Cloud also distinguishes schema checks, aggregate comparisons, and row-level validation in its data warehouse migration validation guide.

Test changes made during the copy and replay an interrupted batch

The store continued taking orders after the initial snapshot. Two committed changes follow position 7000. In this rehearsal the source then pauses writes, and 7002 becomes the final position to reconcile. Positions are ordered commit markers for this example. Two changes can share a timestamp, so the time on a worker's clock alone cannot identify the last change it applied.

MarkEventTarget check
7001Set O-042 to 1200 EUR cents.100 orders. EUR total 516.00.
7002Add O-101 for C-B at 1800 USD cents.101 orders. USD total 532.00.
  1. Apply change 7001 to the repaired copy and commit its checkpoint. Read O-042 back. Its owner is C-A and its amount is now EUR 12.00. The replacement adds EUR 2.00 to the group total.
  2. Interrupt the rehearsal while applying 7002, before the target transaction commits. In this design the order write and checkpoint share a transaction. After recovery, expect checkpoint 7001 and zero committed copies of O-101.
  3. Resume from the saved checkpoint through 7002. Check that O-101 appears once for C-B, then read the checkpoint. It should now be 7002.
  4. Simulate losing the completion acknowledgement and submit the same batch again. Compare the complete target rows before and after the replay. Both reads should contain the same 101 orders with the same owners and amounts, including exactly one O-101.

Compare the final target with the source through position 7002. Expect 51 USD orders worth USD 532.00 and 50 EUR orders worth EUR 516.00. The source at 7000 remains the reference for the original load. Keeping both extracts lets a reviewer distinguish a legitimate late order from a duplicate introduced during recovery.

Cutover and post-migration checklist

  • Confirm the final boundary. Have the source owner confirm which writes have stopped or where they are routed. Record the last included commit, verify that each required change through it was applied, and match any rejected records to approved exceptions.
  • Read through the application. As a support user, find O-099 and open O-100 by its customer-facing order number. Check the amount, currency, and number of matches. As the two buyers, verify the repaired ownership of O-042 in order history.
  • Record the decision. Keep the source and target extract IDs, mapping version, final checkpoint, discrepancy report, and business owner's decision together. In this example a missing order, a duplicate, a wrong owner, or a currency mismatch holds the switch.
  • Observe the first target write. After switching, record a newly accepted order's key, amount, and owner. Retrieve it through the support view and again after any scheduled synchronization. Expect one order with those values.
  • Check the recovery path. If the target has already accepted a new order, identify how that order would reach the system that resumes service. Rehearse retrieving it there before relying on a traffic reversal. AWS describes how recovery changes once the destination has accepted transactions in its cutover and rollback guidance.

A filled handover entry for the corrected rehearsal could read Go at position 7002. Reconciled all 101 order keys and their owners, amounts, and currencies. Replayed the final batch and verified both buyer histories. Retail Operations accepts the order history for cutover. The release QA checklist covers the other release decisions, including deployment ownership and the observation window.

FAQ

Write down the intended relationship before calculating expected counts. If three shipping rows become one shipment, retain the three source keys mapped to the new shipment key. Verify the recipient, the combined quantities, and that each source row contributes exactly once. The approved grouping gives you an expected target count you can defend.

Partition the population by a stable key range or store and record which partitions have finished. Run full key and total checks where feasible, then choose value-level checks for high-risk transformations and exceptions. If some values are sampled, record how the sample was chosen and which records or fields still lack a full comparison.

Seed an order the business permits removing and include it in the initial snapshot. Delete it in the source, capture that change's position, and check the agreed target outcome, such as removal from search or a retained cancellation record. Replay the change and verify that an older update cannot make the order active again.

Ask both owners for extracts with the same scope and commit boundary, stable business keys, currency, amount, and a consistent customer mapping. Confirm that the exports include every page of results. Record extraction settings and the row count in each file so another reviewer can reproduce the comparison without broad database access.

Ready to turn this guide into a working QA project with statuses, comments, and CSV export?