mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 20:58:00 +00:00
ExecUp/ExecDown now take (ctx, Migration, sql string) instead of (ctx, Migration) with embedded Up/Down fields. Applied returns []Migration instead of []AppliedMigration. - pgmigrate, mymigrate, litemigrate, msmigrate: new interface, v1.0.2 dep - shmigrate: v1.0.2 dep, remove temporary replace directive - cmd/sql-migrate: v1.0.2 dep
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.