Keep database schemas in sync across a team of developers regardless of what programming language each person uses.
Automate schema migrations in a Docker-based deployment pipeline using the dbmate Docker image.
Generate a plain-text schema.sql snapshot after every migration so database changes are reviewable in version control.
Requires a running database instance, connection is configured via DATABASE_URL environment variable or a .env file.
Dbmate is a command-line tool for managing database migrations. A migration is a versioned change to a database schema, such as adding a new table, renaming a column, or creating an index. When multiple developers are working on the same project, or when you need to deploy changes to a production server, keeping everyone's database structure in sync can get messy. Dbmate solves this by letting you write migration files in plain SQL, track which ones have been run, and apply or roll back changes in a consistent order across all environments. The tool works with MySQL, PostgreSQL, SQLite, ClickHouse, BigQuery, and Spanner. Because it uses plain SQL rather than a language-specific API, it does not depend on any particular programming framework or language. The same tool can be used on a team that mixes Go, Node.js, Python, Ruby, or any other language, which is one of the stated reasons it was built. Migration files are named with a timestamp prefix, which prevents version number conflicts when two developers create migrations independently and then merge their work. Each migration is run inside a database transaction, so a partially applied migration will be rolled back automatically if something goes wrong. Dbmate also saves a schema.sql file after each migration, giving you a plain-text snapshot of the full database structure that can be reviewed in version control like any other file. The database connection is configured through an environment variable called DATABASE_URL, and dbmate automatically reads a .env file in the current directory so you do not have to set variables manually in development. Commands cover the full migration lifecycle: creating a new migration file, running pending migrations, rolling back the most recent one, checking migration status, creating or dropping the database, and waiting for the database to become available before running a command (useful in Docker-based setups). Dbmate ships as a single binary with no dependencies. It can be installed via Homebrew on macOS, npm, a direct binary download on Linux, Scoop on Windows, or pulled as a Docker image. The full README is longer than what was shown.
← amacneil on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.