migrate
Database migrations. CLI and Golang library.
What is migrate?
Database migrations. CLI and Golang library.
Overview of migrate
What it is
Database migrations written in Go. Use as CLI or import as library.
Migrate reads migrations from sources and applies them in correct order to a database.
Drivers are "dumb", migrate glues everything together and makes sure the logic is bulletproof. (Keeps the drivers lightweight, too.)
Database drivers don't assume things or try to correct user input. When in doubt, fail.
Forked from mattes/migrate.
Key features
- Supports multiple databases: PostgreSQL, PGX v4, PGX v5, Redshift, Ql, Cassandra / ScyllaDB, SQLite, SQLCipher, MySQL / MariaDB, Neo4j, MongoDB, CrateDB (todo), Shell (todo), Google Cloud Spanner, CockroachDB, YugabyteDB, ClickHouse, Firebird, MS SQL Server, rqlite.
- Supports multiple migration sources: Filesystem, io/fs, Go-Bindata, pkger, GitHub, GitHub Enterprise, Bitbucket, Gitlab, AWS S3, Google Cloud Storage.
- CLI usage: simple wrapper around the library, handles ctrl+c (SIGINT) gracefully, no config search paths, no config files, no magic ENV var injections.
- Go library: API stable and frozen for v3 & v4, uses Go modules, supports graceful stops via GracefulStop chan bool, bring your own logger, uses io.Reader streams for low memory overhead, thread-safe and no goroutine leaks.
- Migration files: each migration has an up and down migration (e.g., 1481574547_create_users_table.up.sql and .down.sql).
Use cases
- Applying database schema changes in a controlled, versioned manner.
- Using as a CLI tool to run migrations from local files or remote sources.
- Integrating as a library in a Go project to programmatically manage migrations.
- Running migrations in Docker containers.
Getting started
See the repository README for detailed getting started guide. Basic CLI usage:
$ migrate -source file://path/to/migrations -database postgres://localhost:5432/database up 2
Docker usage:
$ docker run -v {{ migration dir }}:/migrations --network host migrate/migrate
-path=/migrations/ -database postgres://localhost:5432/database up 2
License and pricing
License is not stated (NOASSERTION). Pricing is open source.
Based on the project's public README and repository metadata.