What's new in Badger Trek
Version 0.6.0 November 2026
MySQL
trek init --provider mysql, for MySQL 8.4 and 9.7, the LTS releases still supported. Deploy, revert, verify, repeatables, bundles, the schema fingerprint anddiff-schemawork as on the other databases. MySQL commits DDL as it runs, so changes run without a transaction and are recorded only when all of them ran. Scripts are split like themysqlclient, withDELIMITERaround stored program bodies. See MySQLtrek add --from-diffanddiff-schema --scriptwrite MySQL changes, withALTER TABLEfor tables and a shadow database on the same server
MariaDB
trek init --provider mariadb, for MariaDB 10.11, 11.4, 11.8 and 12.3, the LTS releases still supported: the MySQL provider in MariaDB mode, with sequences in the fingerprint. Amysqlenvironment that turns out to be MariaDB, or the other way round, stops with the provider to use. See MariaDB
Converting
trek convertmoves MySQL and MariaDB databases to and from SQL Server, PostgreSQL, SQLite and each other: types, keys, indexes, views and data. Functions, procedures and triggers are written commented out for review, for now. See Convertingtrek convert schemaalways needs--to(breaking): no pair of providers is a default any more- Fixed: converting into SQL Server with sequences no longer makes
trek verifyreport drift; the target's default schema is no longer created or dropped; a view that calls a routine which could not be translated is commented out with it
Version 0.5.0 November 2026
Supported database versions (breaking)
- trek now supports, and tests, only database versions their vendor or distribution still supports: SQL Server 2019 or later (was 2016 SP1), PostgreSQL 15 or later (was 12; 12, 13 and 14 have reached their end of life), and SQLite 3.26 or later as before (RHEL 8 is supported until 2029). Azure SQL is unaffected
trek doctorsays when a SQL Server or PostgreSQL server is older than that
Entity Framework Core
trek import efturns EF Core migrations into a trek project: one change per migration, withUp()as the deploy script andDown()as the revert. Point it at the project that holds the migrations and trek runsdotnet ef migrations scriptfor both directions, or give it the scripts. The provider comes from the SQL, for SQL Server, PostgreSQL and SQLitetrek baseline --from efadopts databases EF already migrated, by reading their__EFMigrationsHistory. See Moving from other tools
Converting to SQLite
trek convert schema --to sqlitewrites SQL that SQLite 3.26 runs: PostgreSQL's JSON operators becomejson_extract,NULLS LASTanIS NULLsort key, aggregateFILTERaCASE,RIGHT JOINaLEFT JOIN, andUPDATE ... FROMin triggers correlated subqueries. What has no older form is marked for reviewtrek convert datainto SQLite with a relativedatabase:finds the file the converted project was deployed to, and stops instead of loading into or creating the wrong one
Version 0.4.1 November 2026
Upgrading from Badger SQL Migrate
- A database deployed by Badger SQL Migrate no longer looks empty to trek. 0.4.0 found no trek journal in it, showed every change as pending, and a deploy would have run them all again. trek now stops with the SQL that moves the old journal to the
trekstate schema once, keeping the full history, or suggestsstateSchema: bsm. trek still reads nothing from the old journal itself - A folder with
bsm.yamland notrek.yamlgets the rename steps instead of "run trek init" - New page: Upgrading from Badger SQL Migrate. Moving the journal replaces the 0.4.0 advice to adopt each database with
trek baseline - The nuget.org package page and
trek ai-guidenow explain the rename
Version 0.4.0 November 2026
Renamed to Badger Trek (breaking)
- Badger SQL Migrate is now Badger Trek: the command is
trek, the NuGet packageBadger.Trek(Badger.SqlMigrateis deprecated), the repositorylonebadger-tech/badger-trek. Project files aretrek.yamlandtrek.plan, the journal schematrek(trek_*tables on SQLite), script directives-- trek:, variables{trek.*}, environment variablesTREK_*, the home folder~/.trek, and lint codesTREK001and up - There is no backwards compatibility: trek reads nothing from 0.3.0 and earlier, and a database deployed by an earlier version has no trek journal. To move over, run
dotnet tool uninstall -g Badger.SqlMigrateanddotnet tool install -g Badger.Trek, rename the project files and the names inside the scripts, and adopt each existing database withtrek baseline
SQLite
- A SQLite provider (
trek init --provider sqlite): database files with the engine built in, nothing to install. Statement splitting as thesqlite3shell does it, a file lock for the whole deploy, a schema fingerprint, andadd --from-diff/diff-schema --scriptthat useALTER TABLEwhere SQLite can and the documented table rebuild where it cannot. Imports and Sqitch/Flyway projects map to it - Works with SQLite 3.26 and later.
sqlite.minVersionintrek.yamlis the oldest SQLite that opens the project's databases, and lint TREK008 warns about SQL newer than that. On Linux systems older than glibc 2.33 (RHEL 8, Ubuntu 20.04, Debian 11) trek uses the system's libsqlite3;TREK_SQLITE_LIBRARYpicks one explicitly andtrek doctorshows which is in use - Behaviour change: with the default
minVersion: "3.26",add --from-diffdrops a column by rebuilding the table instead ofALTER TABLE ... DROP COLUMN. SetminVersion: "3.35"to keep the old output
Converting databases
trek convert schematurns a live SQL Server, PostgreSQL, MySQL, MariaDB or SQLite database into a new trek project for another of them: types mapped, views, functions, procedures and triggers translated, and every uncertain spot marked for review and listed inCONVERSION.md. See Converting databasestrek convert datathen copies the rows (bulk copy,COPYor prepared inserts) and compares row counts
AI assistants
trek mcpis a Model Context Protocol server for Claude Code, Claude Desktop, VS Code, Cursor and other MCP clients: tools to add changes with their scripts, set!notx, rework, write repeatables, runplan checkwith lint codes, lint SQL and render scripts. It reads and writes project files only and never connects to a database- A guide for AI assistants (
trek ai-guide, and the AI assistants page): how to write deploy, revert and verify scripts that trek certifies, for SQL Server and PostgreSQL trek initandtrek importwrite anAGENTS.mdinto new projects (--no-agents-fileto skip)--jsonoutput foradd,rework,tag,initandrender;plan check --jsonlists each lint finding with its code, file and linevarsandrenderno longer need the environment's password or other sign-in secrets
Fixes
--connection-stringis used as given: the environment's user, password, authentication andtlssettings no longer override the ones in the string- SQL Server 2016: deploy, verify,
add --from-diff, Always Encrypted keys andconvert datano longer fail on columns and functions added in later versions; temporal tables fingerprint the same on 2016 and later - PostgreSQL 14.25, 15.20, 16.16, 17.12, 18.7 and later: every table no longer shows as drifted (internal
pg_attvercolumn options are left out) - On Windows, the MCP server's
add_changeandrework_changeno longer hang looking up git's user name - A failure recording the schema fingerprint after a deploy is a warning, and the next deploy records it;
trek verifysays when no fingerprint is recorded instead of reporting a match trek doctorworks for logins without VIEW SERVER STATE;revert -yno longer prints "would revert"; a missing SQL Server database gets a clear message
SQL projects (SSDT)
trek import sqlprojconverts classic and SDK-style.sqlprojprojects: one change per table, type, schema and other object, in dependency order with[requires]and generated reverts; views, procedures, functions and triggers become CREATE OR ALTER repeatables; the post-deployment script (with:rincludes) and SqlCmdVariables come along; foreign-key cycles are split into later changestrek baseline --from sqlprojadopts databases published from the dacpac without running anything (the post-deployment and permission scripts run once on the next deploy, since the database may have older versions); environments at different versions are adopted oldest first, capturing each one's lead withtrek add --from-diff- Every
trek baselineon SQL Server records the repeatables whose live definition already matches the script and lists the ones that differ, so the first deploy re-applies only those
Version 0.3.0 November 2026
PostgreSQL
- A PostgreSQL provider, tested on PostgreSQL 12 through 18:
trek init --provider postgresql - Everything SQL Server has: certified plans, revert from stored scripts, environments, variables, bundles,
diff-schema, rework, repair and imports - Statement splitting that understands dollar-quoted bodies;
CREATE INDEX CONCURRENTLYand friends run in!notxchanges - Password, Kerberos and Entra ID sign-in (Azure Database for PostgreSQL), TLS modes, SSH tunnels, any Npgsql setting
- A schema fingerprint over PostgreSQL's catalog, from tables, constraints and functions to grants, comments, policies, publications and foreign servers; partitions and privileges can be left out per environment
trek add --from-diffanddiff-schema --scriptgenerate PostgreSQL DDL: tables, partitions, columns and renames, constraints, indexes, views, functions, triggers, policies, types, sequences, comments and grants, ordered by PostgreSQL's dependency catalog; what PostgreSQL cannot change in place is reported, not guessed- psql scripts run as they are:
\i/\irincludes and\copy … from 'file'become part of the change (hashed, stored, bundled);\setand:'variables',\if,\echo,COPY … FROM STDINdata and\gexecwork without psql trek baseline --from sqitchadopts PostgreSQL databases Sqitch deployed, checking its script hashes; imports take--provider postgresql
Version 0.2.0 November 2026
Fixing deployed changes
trek reworkadds a change that supersedes a deployed one, with a revert that restores the previous versiontrek repairaccepts harmless edits to deployed changes, such as a fixed revert script, without running SQL, and re-certifies the journaltrek revert --repeatableputs a view, procedure or function back to its previous definition
Build once, deploy everywhere
trek bundle createpacks the plan, scripts and configuration into one byte-reproducible file with SHA-256 hashes--bundleruns any command from a bundle after checking every hash and the plan head
Schema drift
trek diff-schemalists the objects changed since the last deploy, or the differences between two environments, with line diffs for modules
Generating changes
trek add <name> --from-diffturns schema edits made in your own database into a change: it builds a shadow database from the plan, compares, and writesdeploy.sqlandrevert.sql- Tables, columns, renames, keys, indexes, constraints, views, procedures, functions, triggers, types, sequences, synonyms, temporal tables and partitions; risky edits are reported, not guessed
trek diff-schema --against env --script filewrites T-SQL between any two databases- No extra components: everything comes from SQL Server's catalog views
Moving from other tools
trek import flywayconverts versioned, undo and repeatable migrations, placeholders (including Flyway's built-ins), per-script settings and environments fromflyway.tomlorflyway.conftrek import dbupconverts scripts in DbUp's order,$variables$and run-always scriptstrek import grateconverts grate and RoundhousE folders in grate's run order,{{tokens}}and*.ENV.*scriptstrek import sqitchconverts Sqitch plans with dependencies, tags and reworked changestrek baseline --from flyway|dbup|grate|roundhouseadopts a database from the old tool's journal, checking Flyway's checksums and grate's hashes, and records the repeatables it already applied- Imports mark scripts that cannot run in a transaction
!notx
System-versioned tables and partitions
- The schema fingerprint records system versioning (period columns, history table, retention) and partitioning (functions, boundaries, schemes, partitioned tables and indexes)
- History tables named by SQL Server fingerprint the same on every server
schemaFingerprint.partitionBoundaries: ignorefor partitions maintained by a sliding-window job- Lint rule TREK004: system versioning switched off and not back on
- Databases with these features deployed by 0.1 get a warning instead of a drift error until their next deploy
Version 0.1.0 November 2026
The first release.
Migrations
- Named changes ordered by
trek.plan, with dependencies, tags,!notxand!irreversible; merges cleanly with git's union driver - Deploy, revert and verify scripts; each change, its verify script and its journal row commit in one transaction
- Revert runs the scripts stored in the database at deploy time;
--to,--last,--allandrebase - Repeatable scripts (views, procedures, functions) with dependency ordering, and environment-only scripts
- Baseline an existing database; reviewable SQL script output with
deploy --script
Certification and safety
- SHA-256 script hashes and a hash chain over the plan; certified status when a database matches the plan exactly
- Schema fingerprint after each run and drift detection with
verify - Edited-after-deploy detection, deploy lock for concurrent deployers, dependency or strict ordering
- T-SQL linter: statements that cannot run in a transaction,
USE, explicit transactions
Environments and connectivity
- Environments with
extends, templates,protected,allowRevertand a database ownership guard - SQL logins, Windows/Kerberos, and every Microsoft Entra ID flow including MFA with a persistent token cache
- Any SqlClient connection-string setting, strict TLS (TDS 8.0), SSH tunnels with host-key verification
- Always Encrypted column master and column encryption keys per environment, with rotation; Azure Key Vault, Windows stores and custom key store providers
- Script variables: built-ins like
{env}and{db}, nested and per-environment variables, rendered-SQL hashes
Platforms
- Windows, macOS and Linux (x64 and Arm64, glibc and musl), a portable build, and a .NET global tool