- Home
- Database Migration Tools
- golang-migrate
golang-migrate
What it is
golang-migrate reads database migrations from a source and applies them to a database in order. It is an open-source project that can be run as a command-line tool or imported as a Go library. Each logical migration has an up file and a down file, providing a corresponding reversal. Listed database drivers include PostgreSQL, MySQL/MariaDB, SQLite, MongoDB, Neo4j, CockroachDB, and Google Cloud Spanner. Migration sources include local files, embedded Go data, GitHub, GitLab, Bitbucket, AWS S3, and Google Cloud Storage. The CLI handles Ctrl+C gracefully and does not use config search paths, config files, or automatic environment-variable injection. The library uses io.Reader streams, is described as thread-safe, and supports graceful stopping through a GracefulStop channel to help prevent database corruption. The project documents Docker use with a mounted migration directory. It is distributed under the MIT License, which requires retaining copyright and permission notices. Its v3 and v4 APIs are described as stable and frozen; master and 4.x are supported, while 3.x and earlier are unsupported.
For and against
For
- Use it as a CLI or import it as a Go library.
- Each migration has an up file and a down file.
- Supports listed drivers including PostgreSQL and SQLite.
- Sources include local files, GitHub, and cloud storage.
- Library provides a GracefulStop channel.
Against
- Versions 3.x and earlier are unsupported.
- MIT License requires retaining copyright and permission notices.
The verdict
golang-migrate combines ordered database changes with both command-line and Go library use. Check its supported-version policy before adopting an older release.
Who it suits
It suits developers who need to apply and reverse database changes from command-line workflows or Go applications. Teams can choose among the listed database drivers and migration sources, including self-hosted options.
Plans and prices
Open source
No paid plans or usage limits stated on the project pages opened
Read 4 Oct 2026 · github.com
On the record
- CLI behavior
- The CLI handles Ctrl+C gracefully and has no config search paths, config files, or automatic environment-variable injections.github.com · read 4 Oct 2026
- Database support
- Listed database drivers include PostgreSQL, MySQL/MariaDB, SQLite, MongoDB, Neo4j, CockroachDB, and Google Cloud Spanner.github.com · read 4 Oct 2026
- Docker
- The README documents running the migrate CLI in Docker with a mounted migration directory.github.com · read 4 Oct 2026
- Graceful stopping
- The library supports graceful stops through a GracefulStop channel to help prevent database corruption.github.com · read 4 Oct 2026
- Library compatibility
- The README describes the v3 and v4 library API as stable and frozen for those releases.github.com · read 4 Oct 2026
- Library properties
- The README says the library uses io.Reader streams for low memory overhead and is thread-safe with no goroutine leaks.github.com · read 4 Oct 2026
- License
- The project is distributed under the MIT License, which requires retaining the copyright and permission notices.github.com · read 4 Oct 2026
- Migration files
- Each logical migration has an up file and a down file.github.com · read 4 Oct 2026
- Migration sources
- Sources include local filesystem, embedded Go data, GitHub, GitLab, Bitbucket, AWS S3, and Google Cloud Storage.github.com · read 4 Oct 2026
- Purpose
- golang-migrate reads database migrations from sources and applies them to a database in order.github.com · read 4 Oct 2026
- Security reporting
- The security policy asks reporters to start a GitHub security advisory and suggest potential impact and urgency.github.com · read 4 Oct 2026
- Supported versions
- The security policy marks master and 4.x as supported, while 3.x and earlier are unsupported.github.com · read 4 Oct 2026
- Ways to use
- The project can be used as a command-line tool or imported as a Go library.github.com · read 4 Oct 2026