Windows & Linux

CLI release

Coming January 2027. The dbHydrate command-line tool isn't available yet. These preview docs describe the planned first release; commands and options may change.
Browse CLI documentation

Exit codes and reports

Every command ends with an exit code your pipeline can act on, and can write reports you keep as build artifacts.

On this page

Exit codes

Planned dbhydrate exit codes
CodeMeaning
0No differences (compare), or the dry run or apply succeeded.
1Differences found (unless --no-fail-on-drift), or the dry run or apply failed.
2A configuration, file, connection or seat-lease problem, or the licensing service could not be reached.
3Refused by licensing: no valid license or trial for this action, or the file is revoked, expired or from another account.
4The seat is busy with another run. Add --wait <duration> to queue instead.
130Cancelled (Ctrl+C or the CI job was stopped). Uncommitted changes are rolled back, temporary databases are removed and the seat is released.

Exit codes by command

Which exit codes each command can return
Command01234130
compareNo differencesDifferences, or an incomplete readYesYesYesYes
dry-runEvery step passedA step failedYesYesYesYes
applyAppliedA step failedYesYesYesYes
file inspectValid file—Unreadable or edited file———

Handling exit codes in Bash

Code example
dbhydrate compare --run release.dbhrun --report report.md
case $? in
  0) echo "No schema drift" ;;
  1) echo "Drift found: review report.md"; exit 1 ;;
  3) echo "Refused by licensing: check the file and license"; exit 1 ;;
  4) echo "Seat busy: retry later"; exit 1 ;;
  *) echo "Run failed"; exit 1 ;;
esac

Handling exit codes in PowerShell

Code example
dbhydrate compare --run release.dbhrun --report report.md
switch ($LASTEXITCODE) {
  0 { "No schema drift" }
  1 { "Drift found: review report.md"; exit 1 }
  4 { "Seat busy: retry later"; exit 1 }
  default { "Run failed"; exit 1 }
}

Reports

CI runners are often wiped after each job, so every command can write its result to files you keep as build artifacts. Markdown (--report) is for people and pull-request comments; JSON (--json) is for other tools. A short summary always goes to the console.

What dbhydrate reports contain
ReportContainsSQL
compareEach differing object: type, name, change and whether it is destructive; totals; whether the read was completeNever
dry-runEach step: passed or failed, the database’s error, timingLicenses only
applyAs dry run, plus applied, rolled back or failedLicenses only

Reports never contain passwords, passphrases, key shares or license keys.

JSON report example

JSON example
{
  "command": "compare",
  "engine": "postgres",
  "complete": true,
  "differences": [
    { "object": "table", "name": "public.orders", "change": "changed",
      "detail": "column \"discount_code\" missing on target", "destructive": false },
    { "object": "index", "name": "public.idx_orders_date", "change": "added", "destructive": false }
  ],
  "totals": { "differences": 2, "destructive": 0 }
}

An illustration of the planned structure. The final JSON format is published with the first release, and later changes will be versioned.