mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
Core library: - Replace O(n*m) isApplied linear scan with map lookups (appliedSets) - Wrap exec errors with ErrExecFailed in Up and Down - Add tests for Collect with subpath and empty subpath - Add tests for Latest and Drop convenience wrappers - Add tests for Applied() error propagation in Up/Down/GetStatus - Add tests for ErrExecFailed wrapping - Add tests for context propagation and cancellation - Store received context in mock for propagation assertions shmigrate: - Return ErrExecFailed on missing migration file instead of writing a comment and continuing - Use r.FS for file stat (consistent with Applied), falling back to os.Stat when FS is nil
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.