mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 12:48:00 +00:00
API changes for v1: - Collect(fsys, subpath) takes a subdirectory path (use "." for root), enabling embed.FS with //go:embed sql/migrations/*.sql - Latest() applies all pending migrations (shorthand for Up with n=-1) - Drop() rolls back all applied migrations (shorthand for Down with n=-1)
sqlmigrate
Database-agnostic SQL migration library for Go.
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.