AJ ONeal 67ad7a9fa2 fix(litemigrate,mymigrate,msmigrate): take *sql.Conn instead of *sql.DB
Same issue as pgmigrate: *sql.DB is a connection pool, so each call
may land on a different connection. Migrations need a pinned connection
for session state (SET search_path, temp tables, etc.) to persist
across sequential calls. *sql.Conn (from db.Conn(ctx)) pins one
underlying connection for its lifetime.
2026-04-09 10:56:47 -06:00
..

sqlmigrate

Database-agnostic SQL migration library for Go.

Go Reference

Backend packages

Each backend is a separate Go module to avoid pulling unnecessary drivers:

Package Database Driver
pgmigrate PostgreSQL pgx/v5
mymigrate MySQL / MariaDB go-sql-driver/mysql
litemigrate SQLite database/sql (caller imports driver)
msmigrate SQL Server go-mssqldb
shmigrate Shell scripts (uses native CLI)

CLI

The sql-migrate CLI uses shmigrate to generate shell scripts for managing migrations without a Go dependency at runtime.