sqlmc list coverage: Recipes
Fail a build when the estate drifts.
Fail a build when the estate drifts.
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.