sql-migrate is a SQL schema migration tool for Go that works both as a standalone CLI tool and as an embeddable library.
The tool addresses the need to manage database schema changes in Go applications through version-controlled SQL migrations. It stores migration history in a database table and applies migrations sequentially, supporting both forward migrations and rollbacks. Migrations are written in plain SQL, giving developers full flexibility over schema changes. The tool can embed migrations directly into compiled Go binaries, eliminating external file dependencies at runtime.
The project suits Go applications that need reliable schema versioning across SQLite, PostgreSQL, MySQL, MSSQL, and Oracle databases. It works well for teams preferring SQL over abstraction layers and integrates naturally with other Go database libraries. The tool is particularly useful during development with its redo command, which unapplies and reapplies the most recent migration without manual intervention. For projects supporting multiple database systems, sql-migrate allows defining migrations that work across different database types within a single codebase.
Development activity shows consistent maintenance with regular updates addressing edge cases and database-specific requirements. The project maintains comprehensive test integration setups for each supported database, demonstrating attention to cross-platform compatibility. Documentation includes practical examples for different database configurations and setup patterns, reflecting responsiveness to real-world usage scenarios. The codebase remains actively refined with fixes for database-specific issues such as MySQL's parseTime requirement and Oracle driver options.