sqlmc list coverage: Recipes

Fail a build when the estate drifts.

Last updated 2026-10-21

Fail a build when the estate drifts.

Failing a build when the estate drifts: --fail-on-drift makes sqlmc exit 1 when anything was observed to differ.
Failing a build when the estate drifts: --fail-on-drift makes sqlmc exit 1 when anything was observed to differ.
sqlmc list coverage --list "All Prod" --yes --fail-on-drift --json > coverage.json || {
  echo "schema drift or an unreadable database; see coverage.json"
  exit 1
}

--fail-on-drift turns an observation into a verdict. Leave it off when you want the report but not the opinion.

Track drift over time.

sqlmc list coverage --list "All Prod" --yes --json |
  jq -S '.data.findings' > "drift-$(date +%F).json"
diff "drift-$(date -d yesterday +%F).json" "drift-$(date +%F).json"

Sort the keys, or an unordered diff will be noise.

Scan, fix, scan again. Scan to find what is missing, run the fix across the group from the app or (when it lands) sqlmc run, then scan again. The second scan is the evidence; the first one is only the hypothesis.