Deploy database schema changes alongside application updates without manual SQL scripts.
Roll back a failed migration to restore the previous database state when something goes wrong.
Store migration files in your Git repository and apply them automatically in CI/CD pipelines.
Embed migrations directly in a compiled Go binary so the database schema updates when the app starts.
migrate is a database migration tool for Go, available both as a command-line program and as an importable library. Database migrations are the controlled, versioned changes made to a database's structure over time, for example, adding a new column to a table or creating a new table entirely. Managing these changes systematically prevents databases from drifting out of sync with the application code that uses them. The tool reads migration files from a source, applies them to a database in the correct order, and tracks which migrations have already run. Migration files come in pairs: one file applies a change (the "up" direction) and one reverses it (the "down" direction), allowing rollbacks. Sources for migration files include the local filesystem, embedded binary data in a Go binary, remote GitHub repositories, Bitbucket, GitLab, AWS S3, and Google Cloud Storage. A wide range of databases are supported as migration targets, including PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, CockroachDB, ClickHouse, Microsoft SQL Server, Cassandra, and others. Database connection strings are passed as URLs. The library is thread-safe, uses streaming internally to minimize memory usage, and supports graceful cancellation via a stop channel. The API has been stable since version 4. A Docker image is also available for running migrations without installing Go.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.