mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 15:05:00 +00:00
- Change Down(n<=0) to mean "rollback all" (matching Up semantics). CLIs now explicitly pass 1 when no count is given. - Add 22 tests for Collect, NamesOnly, Up, Down, and GetStatus using mock Migrator and fstest.MapFS. - Fix shmigrate.Applied to stream from file instead of ReadFile double-wrap; add optional FS field for embed.FS support. - Update package doc to list all 5 backends. - Add minimal README linking to pkg.go.dev.
23 lines
1.2 KiB
Markdown
23 lines
1.2 KiB
Markdown
# sqlmigrate
|
|
|
|
Database-agnostic SQL migration library for Go.
|
|
|
|
[](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate)
|
|
|
|
## Backend packages
|
|
|
|
Each backend is a separate Go module to avoid pulling unnecessary drivers:
|
|
|
|
| Package | Database | Driver |
|
|
|---------|----------|--------|
|
|
| [pgmigrate](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate/pgmigrate) | PostgreSQL | pgx/v5 |
|
|
| [mymigrate](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate/mymigrate) | MySQL / MariaDB | go-sql-driver/mysql |
|
|
| [litemigrate](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate/litemigrate) | SQLite | database/sql (caller imports driver) |
|
|
| [msmigrate](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate/msmigrate) | SQL Server | go-mssqldb |
|
|
| [shmigrate](https://pkg.go.dev/github.com/therootcompany/golib/database/sqlmigrate/shmigrate) | Shell scripts | (generates POSIX sh) |
|
|
|
|
## CLI
|
|
|
|
The [sql-migrate](https://pkg.go.dev/github.com/therootcompany/golib/cmd/sql-migrate/v2) CLI
|
|
uses shmigrate to generate shell scripts for managing migrations without a Go dependency at runtime.
|