Lone Badger Tech

Documentation

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

Badger Trek deploys hand-written SQL changes to SQL Server, Azure SQL, PostgreSQL, MySQL, MariaDB and SQLite, in an order you control, and proves afterwards that every database received exactly what you intended. It is a single command-line tool, trek, 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. trek.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 2019 and later (on Windows, Linux and containers, LocalDB included), Azure SQL Database and Azure SQL Managed Instance. PostgreSQL 15 and later. MySQL 8.4 and 9.7 and MariaDB 10.11, 11.4, 11.8 and 12.3 (the LTS releases; see MySQL and MariaDB). SQLite 3.26 and later: trek runs the engine built into it, and the scripts it generates also run on the older SQLite that other programs open your database with (SQLite versions). The engine is vendor-neutral, so other databases can be added as providers (Library and providers).