Badger SQL Migrate
Database migrations for SQL Server, Azure SQL and PostgreSQL that you can prove. Free, cross-platform, with real up and down.
Named changes, no collisions
Changes have names, not version numbers. The plan file merges with git's union driver, so two developers adding changes the same day never collide.
Hash-certified
SHA-256 per change and a hash chain over the whole plan. Same head hash means byte-identical history on every machine and environment.
Real down, for free
Revert scripts are first-class. They are stored in the database at deploy time, so rollback works from any branch, even after the change is gone.
Environments built in
dev, test, prod with inheritance, protected environments, fix-forward production, and a database that remembers which environment owns it.
Every Entra ID flow
Browser and device code with MFA (cached between runs), managed identity, service principals, workload identity, Azure CLI, pipelines, plus SQL and Windows auth.
Always Encrypted keys
Scripts use the same key names everywhere; each environment brings its own column master keys. Badger SQL Migrate provisions and rotates them.
Variables that render
[calc_{env}] becomes [calc_test] in test. Built-ins, nested variables, per-environment values, and a hash of the SQL that actually ran.
Safe by default
A deploy lock for concurrent pipelines, transactional changes with verify scripts, a T-SQL linter, drift detection, and edited-after-deploy detection.
One binary, any OS
Windows, macOS and Linux (x64 and Arm), or a .NET tool. No Java, no Perl, no sqlcmd. Connects through SSH bastions too.
How it works
A project is a folder with a bsm.plan (the order), one folder per change with deploy.sql, revert.sql and an optional verify.sql, and a bsm.yaml describing your environments.
db/
bsm.yaml environments, authentication, variables, keys
bsm.plan one change per line, in deploy order
changes/
create-customer/
deploy.sql up
revert.sql down
verify.sql proves the deploy worked (optional)
repeatable/ views, procedures, functions: re-applied when changed
environments/dev/ scripts that run only in dev (seed data)
bsm add add-customer-email --requires create-customer
bsm deploy -e test
bsm status -e prod
bsm revert --to create-customer -e test
Every deploy records the script hashes, who ran it, where, and a hash chain that certifies the order. bsm status tells you when a database is certified: it received exactly the plan, in order, byte for byte.
Why another migration tool?
Flyway charges for undo and collides when two branches pick the same version number. DbUp only goes up and ignores edited scripts. SSDT computes a different script on each machine. Sqitch has the right model but a Perl install and weak SQL Server support. Badger SQL Migrate keeps the best ideas of each and fixes the gaps. See the comparison →
Documentation · Example scripts · Download · What's new · Source on GitHub