What's new in Badger SQL Migrate
Version 0.3.0 November 2026
PostgreSQL
- A PostgreSQL provider, tested on PostgreSQL 12 through 18:
bsm 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
bsm 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 bsm baseline --from sqitchadopts PostgreSQL databases Sqitch deployed, checking its script hashes; imports take--provider postgresql
Version 0.2.0 November 2026
Fixing deployed changes
bsm reworkadds a change that supersedes a deployed one, with a revert that restores the previous versionbsm repairaccepts harmless edits to deployed changes, such as a fixed revert script, without running SQL, and re-certifies the journalbsm revert --repeatableputs a view, procedure or function back to its previous definition
Build once, deploy everywhere
bsm 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
bsm diff-schemalists the objects changed since the last deploy, or the differences between two environments, with line diffs for modules
Generating changes
bsm 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
bsm 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
bsm import flywayconverts versioned, undo and repeatable migrations, placeholders (including Flyway's built-ins), per-script settings and environments fromflyway.tomlorflyway.confbsm import dbupconverts scripts in DbUp's order,$variables$and run-always scriptsbsm import grateconverts grate and RoundhousE folders in grate's run order,{{tokens}}and*.ENV.*scriptsbsm import sqitchconverts Sqitch plans with dependencies, tags and reworked changesbsm 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 BSM004: 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
bsm.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