dbmate
🚀 A lightweight, framework-agnostic database migration tool.
What is dbmate?
🚀 A lightweight, framework-agnostic database migration tool.
Overview of dbmate
What it is
Dbmate is a database migration tool that keeps database schemas in sync across multiple developers and production servers. It is a standalone command line tool that can be used with Go, Node.js, Python, Ruby, PHP, Rust, C++, or any other language or framework for database-backed applications. It supports MySQL, MariaDB, PostgreSQL, SQLite, and ClickHouse.
Key features
- Uses plain SQL for writing schema migrations
- Migrations are timestamp-versioned to avoid version number conflicts with multiple developers
- Migrations are run atomically inside a transaction
- Supports creating and dropping databases
- Supports saving a
schema.sqlfile to easily diff schema changes in git - Database connection URL is defined using an environment variable (
DATABASE_URLby default) or specified on the command line - Built-in support for reading environment variables from a
.envfile - Single self-contained binary
Use cases
- Keeping database schemas in sync across multiple developers and production servers
- Writing database-backed applications in multiple languages while maintaining consistent development tools
- Managing schema migrations in CI/CD pipelines
- Creating and dropping databases in development and test environments
Getting started
Install using NPM:shnpm install --save-dev dbmatenpx dbmate --helpInstall using Homebrew on macOS:shbrew install dbmatedbmate --helpInstall the binary directly on Linux:shsudo curl -fsSL -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64sudo chmod +x /usr/local/bin/dbmate/usr/local/bin/dbmate --helpInstall using Scoop on Windows:pwshscoop install dbmatedbmate --help
License and pricing
License: MIT. Pricing: open source.
Based on the project's public README and repository metadata.