CI/CD
Checks on every pull request, gated deploys, no stored secrets.
On every pull request
bsm plan check -C db
Needs no database. Fails on plan problems, missing folders or reverts, lint errors, and variables missing in any environment.
On merge and release
bsm deploy -C db -e test --json
bsm deploy -C db -e prod --yes --json # --yes: protected environment, no prompt in CI
bsm verify -C db -e prod
Two pipelines cannot interleave: the second waits for the deploy lock. Use --script review.sql to attach the exact SQL to an approval step, then deploy after approval.
Build once, deploy the same bundle everywhere
bsm bundle create -C db -o db-bundle.zip # build stage: publish as an artifact
bsm --bundle db-bundle.zip deploy -e test --json # each release stage
bsm --bundle db-bundle.zip deploy -e prod --yes --json
A bundle freezes the plan and scripts at build time, and every stage checks its hashes before running anything, so production gets exactly what test got.
Identity without secrets
| Runner | Use |
|---|---|
| GitHub Actions | azure/login with OIDC, then entraAzureCli; or entraWorkloadIdentity |
| Azure Pipelines | entraAzurePipelines with a workload-identity service connection, or entraAzureCli inside an AzureCLI task |
| Azure-hosted agents, VMs, Container Apps | entraManagedIdentity |
| Anything else | entraServicePrincipalCertificate or entraEnvironment with secrets from your secret store |
Complete GitHub Actions and Azure Pipelines files are on the Examples page.
Pin the tool version
dotnet tool install --global Badger.SqlMigrate --version 0.3.0
Containers
DockerfileFROM mcr.microsoft.com/dotnet/runtime-deps:10.0
ADD https://lonebadgerdownloads.blob.core.windows.net/badger-sql-migrate/v0.3.0/badger-sql-migrate-0.3.0-linux-x64.tar.gz /tmp/bsm.tgz
RUN tar -xzf /tmp/bsm.tgz -C /usr/local/bin bsm && rm /tmp/bsm.tgz
COPY db /db
ENTRYPOINT ["bsm", "-C", "/db"]
Applications that migrate themselves
The engine is also a .NET library; see Library and providers.