Esta sección solo está disponible en inglés.

How to fail a CI build when your databases drift apart

Use sqlmc list coverage with --fail-on-drift to turn a schema difference into a non-zero exit code in any pipeline.

Drift is easiest to fix the day it appears. Put the check in your pipeline and it shows up in a build log instead of a customer ticket.

The one-liner

sqlmc is the command-line companion to the app. It reads a workspace and a target group, scans every database, and can fail the build:

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
}
  • --yes skips the confirmation prompt, which a pipeline cannot answer.
  • --fail-on-drift exits 1 when anything was observed to differ. Leave it off when you want the report without the verdict.
  • --json gives a machine-readable report.

Track drift over time

Sort the keys so the diff is not noise:

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"

What ships today

sqlmc ships list coverage and mcp. Running scripts from the command line is not built yet, so use the app for the fix and the CLI for the proof. See what sqlmc is and the recipes.