Checks
How the migrator verifies rows, links and ledgers after every sync.
There is no dry run. To rehearse, sync a backup loaded into a throwaway MariaDB into a test site, then read the checks. Because the migrator copies rows and posts nothing, the checks are what prove the ledgers arrived whole.
Checks run as the last step of every sync. Run them alone with Run checks on the Sync page, or:
bin/frappe-migrator check acmeWhat is checked
| Check | Passes when |
|---|---|
rows: <table> | Every source name of a Mapped or Carried table is in the target, or is a failed row. Rows only in the target are counted, not failed |
| Unclassified tables | One check lists the unclassified tables that have rows |
links: <table> | Every Link and Dynamic Link in the target resolves, or did not resolve in the source either |
trial balance: <company> FY <year> | Debit and credit per account agree, without opening entries |
opening entries: | Opening entries agree |
gl totals per party | GL totals per party agree |
outstanding: <invoice DocType> | outstanding_amount and the Payment Ledger Entry sum agree per invoice |
stock qty, stock value per item and warehouse | Frappe's Bin and both sides' latest Stock Ledger Entry balance agree |
gross pay, net pay per Salary Slip | Pay agrees, with Salary Detail rows |
gst: <invoice DocType> | Taxable value and tax per GST Settings account agree |
Values compare after rounding to the field's precision, from System Settings' currency_precision and float_precision or the field's own.
Figures
Each check stores a status (pass, fail or error), the source figure, the target figure, the difference as target minus source, and details. details["method"] says how the target side was read.
| Target read | When |
|---|---|
| ERP's Trial Balance and HRMS's Salary Register through the API | Setup has a Target API key |
| SQL on the tenant's tables | No API key, or the report answered with an error |
| SQL | Always for stock, since Stock Balance is a prepared report |
If the site does not answer at all, that group is an error check, so an outage shows. A group of checks that raises becomes one error check, and the next group runs.
When a check fails
When a ledger or row check fails, the migrator looks at the rows behind the mismatch. A row edited or deleted in Cardinal since the migrator wrote it is queued for the next sync. That sync rewrites it from Frappe and keeps Cardinal's version as a conflict. details["rewritten by the next sync"] counts those rows.
A failed check never stops the next sync.
Example
After a sync of a Frappe 16 test site, the Checks page showed 258 of 258 checks passing. With the Cardinal node stopped mid-sync, the trial balance and pay checks showed as error, and the next check run passed them.