Lone Badger Tech

Documentation

Everything about Badger SQL Migrate, from the first change to production pipelines.

Badger SQL Migrate deploys hand-written SQL changes to SQL Server, Azure SQL and PostgreSQL, in an order you control, and proves afterwards that every database received exactly what you intended. It is a single command-line tool, bsm, for Windows, macOS and Linux.

Five ideas

  1. Changes have names. A change is a folder (changes/add-customer-email/) with a deploy.sql, a revert.sql and an optional verify.sql. No version numbers to collide.
  2. The plan decides the order. bsm.plan lists changes one per line. Git merges it without conflicts. The plan
  3. Everything is hashed. Each change has a SHA-256 hash, and each position in the plan a chain hash over everything before it. Identical head hash, identical history. Hash certification
  4. Down is real. The database stores the revert script at deploy time and uses it to roll back. Revert
  5. Environments hold the differences. Servers, identities, variables and encryption keys differ per environment; change scripts do not. Environments

Where to start

Supported databases

SQL Server 2016 SP1 and later (on Windows, Linux and containers), Azure SQL Database and Azure SQL Managed Instance. The engine is vendor-neutral, so other databases can be added as providers (Library and providers); SQL Server is the only provider today.