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
- Changes have names. A change is a folder (
changes/add-customer-email/) with adeploy.sql, arevert.sqland an optionalverify.sql. No version numbers to collide. - The plan decides the order.
trek.planlists changes one per line. Git merges it without conflicts. The plan - 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
- Down is real. The database stores the revert script at deploy time and uses it to roll back. Revert
- Environments hold the differences. Servers, identities, variables and encryption keys differ per environment; change scripts do not. Environments
Where to start
- New project: Install, then the Quick start.
- Database already in production: Existing databases.
- Setting up a pipeline: CI/CD and Authentication.
- Looking for a script pattern: Examples.
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).