DEV.co
Open-Source Databases · amacneil

dbmate

Dbmate is a lightweight, language-agnostic database migration tool written in Go that manages schema changes across MySQL, PostgreSQL, SQLite, and ClickHouse. It uses plain SQL for migrations, avoids lock-in to specific frameworks, and distributes as a single self-contained binary.

Source: GitHub — github.com/amacneil/dbmate
7k
GitHub stars
354
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryamacneil/dbmate
Owneramacneil
Primary languageGo
LicenseMIT — OSI-approved
Stars7k
Forks354
Open issues50
Latest releasev2.33.0 (2026-04-29)
Last updated2026-07-03
Sourcehttps://github.com/amacneil/dbmate

What dbmate is

Dbmate is a CLI-based migration manager that timestamps migrations to avoid conflicts, runs them atomically within transactions, and tracks applied migrations in a database table. It supports multiple database backends via standard Go SQL drivers and can be embedded as a library or used standalone.

Quickstart

Get the dbmate source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/amacneil/dbmate.gitcd dbmate# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multi-language/Multi-framework Teams

When your organization uses Go, Node.js, Python, Rust, PHP, and C++ across different services, a single database migration tool eliminates tool fragmentation and training overhead.

Development & Test Environment Setup

Built-in support for creating, dropping, and migrating test databases makes it ideal for CI/CD pipelines, Docker-based development, and rapid test database provisioning.

Schema-as-Code with Git Diffs

Auto-generation of schema.sql files enables easy tracking of schema evolution in version control and simplifies code review of database changes alongside application code.

Implementation considerations

  • Set DATABASE_URL via environment variable or .env file; ensure credentials are URL-encoded and connection strings use correct protocol prefix (postgres, mysql, sqlite, etc.).
  • Migrations run atomically in transactions; verify your database supports DDL transactions (note: some DDL operations in MySQL/MariaDB may not be transactional).
  • Timestamp-based versioning prevents merge conflicts in multi-developer scenarios; ensure all developers' system clocks are reasonably synchronized.
  • Schema.sql auto-dump on migrate/rollback can be disabled with --no-dump-schema; coordinate team policy on whether schema.sql is committed to git.
  • Docker deployment requires --network=host or bind-mount configuration to access databases; test connectivity carefully in containerized environments.

When to avoid it — and what to weigh

  • ORM-Driven Development — If your workflow relies on ORM auto-migration features (e.g., Hibernate, TypeORM, Sequelize), adding a separate CLI tool increases operational burden rather than reducing it.
  • Enterprise Multi-Database Vendor Lock-in — If you require Oracle, SQL Server, or other enterprise databases not listed in supported drivers (MySQL, PostgreSQL, SQLite, ClickHouse, BigQuery, Spanner), dbmate lacks official support.
  • Complex Rollback Requirements — If your migrations require complex conditional rollback logic, feature flags, or zero-downtime deployment strategies, dbmate's basic rollback model may be insufficient.
  • SaaS Observability & Audit Trails — If you need centralized migration audit logs, team approvals, or SaaS-based monitoring, dbmate is intentionally offline-first and does not offer these services.

License & commercial use

Licensed under MIT (Massachusetts Institute of Technology License), a permissive OSI-approved license allowing unrestricted use, modification, and distribution with minimal restrictions.

MIT license explicitly permits commercial use. No proprietary vendor tie-in, SaaS upsell, or usage restrictions. However, verify your organization's license compliance policy and ensure any modifications remain appropriately documented.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

No inherent security vulnerabilities disclosed in provided data. Standard considerations: credentials passed via DATABASE_URL or .env files should never be committed to version control; use environment secrets in CI/CD systems. Dbmate does not provide encryption, audit logging, or role-based access control—rely on database-level controls. Validate migration file integrity, especially if migrations are auto-generated or imported from untrusted sources.

Alternatives to consider

Flyway

JVM-based, supports more databases (Oracle, SQL Server), offers commercial products; heavier footprint, language-specific ecosystem.

Liquibase

XML/YAML/SQL-based, extensive enterprise features, version control; steeper learning curve, more overhead for small projects.

Alembic (Python) / Migrate (Rails) / TypeORM Migrations

Framework-native, tightly integrated with ORMs; language-specific, less portable across polyglot teams.

Software development agency

Build on dbmate with DEV.co software developers

Dbmate is ideal for polyglot teams seeking a lightweight, language-agnostic migration solution. Assess fit against your ORM strategy, database backends, and CI/CD tooling. Consider Flyway or Liquibase for enterprise databases and advanced rollback workflows.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

dbmate FAQ

Can I use dbmate with an ORM like Sequelize or TypeORM?
Yes. Dbmate and ORM migrations can coexist, but coordinating both adds complexity. Common practice: use dbmate for schema management, ORM for query builders. Avoid running both simultaneously on the same database to prevent conflicts.
Does dbmate support rollback of failed migrations?
Dbmate supports rolling back the most recent migration via `dbmate rollback` or `dbmate down`. It does not support partial or selective rollback; migrations are treated as an ordered sequence. If a migration fails mid-execution, it rolls back the entire transaction.
What happens if two developers create migrations with the same timestamp?
Timestamps are generated at millisecond precision; collisions are rare but possible. The --strict flag will fail if migrations would be applied out of order, forcing resolution. Best practice: merge and regenerate migration timestamps or use shared sequential IDs.
Can I use dbmate for BigQuery or Spanner?
Yes. The README mentions BigQuery and Spanner support, but specifics are not detailed in the excerpt. Requires review of driver documentation and connection URL format for these databases.

Custom software development services

Adopting dbmate is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Evaluate Dbmate for Your Schema Management Strategy

Dbmate is ideal for polyglot teams seeking a lightweight, language-agnostic migration solution. Assess fit against your ORM strategy, database backends, and CI/CD tooling. Consider Flyway or Liquibase for enterprise databases and advanced rollback workflows.