dbmate vs sqlx-cli
dbmate
github.comsqlx-cli
github.comSide by side
| Figure | dbmate | sqlx-cli |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| Self-hosted | Yes | — |
| Plans published | 1 | 1 |
| Spec score · Database Migration Tools | 8.6 (#3) | 8.0 (#11) |
| Configuration | Dbmate reads DATABASE_URL by default and has built-in support for loading environment variables from a .env file. | Commands require a database URL supplied through `--database-url`, the `DATABASE_URL` environment variable, or a `.env` file in the current working directory. |
| Database support | The README lists MySQL, MariaDB, PostgreSQL, SQLite, and ClickHouse as supported databases. | Its default installation supports the databases supported by SQLx; installation options include PostgreSQL-only and SQLite-specific configurations. |
| License | The repository includes an MIT license. | The SQLx repository lists Apache-2.0 and MIT license files. |
| Purpose | Dbmate is a database migration tool that keeps database schemas in sync across developers and production servers. | SQLx CLI is a command-line utility for managing databases and migrations and enabling offline mode for SQLx query macros. |
| Support | The repository README links to a discussion of alternatives and a contribution guide, but the opened page does not specify a support service or response time. | The SQLx repository links to its FAQ and Discord community for questions. |
Plans
In their own words
dbmate
dbmate is a free, open-source command-line tool for keeping database schemas in sync across developers and production servers. It works independently of application language and can be used with Go, Node.js, Python, Ruby, PHP, Rust, C++, and other languages or frameworks. Migrations are plain SQL in timestamp-versioned files. Commands create, apply, and roll back migrations, check status, dump or load a schema, and wait for a database server. The project lists MySQL, MariaDB, PostgreSQL, SQLite, and ClickHouse, and documents BigQuery connections and Spanner support for databases using the PostgreSQL dialect. Migrations run atomically in a transaction by default when the database supports transactions, though individual migration blocks can opt out. dbmate can maintain a schema.sql dump for source-control review and Git diffs; creating dumps relies on database client tools such as pg_dump, mysqldump, or sqlite3. It reads DATABASE_URL by default and can load environment variables from a .env file. Installation options include NPM, Homebrew, Scoop, a Linux binary, and Docker images. Go applications can use it as a library, and Go embed can package migrations into an application binary.
sqlx-cli
sqlx-cli is SQLx’s command-line utility for managing databases, migrations, and offline preparation for query macros. It can create or drop the database identified by a database URL, and create, run, inspect, or revert migrations, including paired up and down scripts. The `cargo sqlx prepare` command writes query metadata to a `.sqlx` directory. Once that metadata is checked into version control, builds can run without an active database connection. The `--check` option returns a nonzero status if the saved metadata is out of date, a behavior the project describes for continuous integration.
For workspaces whose crates use query macros, `cargo sqlx prepare --workspace` places one `.sqlx` directory at the workspace root. Commands accept the database URL through `--database-url`, the `DATABASE_URL` environment variable, or a `.env` file in the current directory. The project lists PostgreSQL, MySQL, MariaDB, and SQLite support, with installation options for database drivers and TLS backends. The CLI is free and open source under the user’s choice of Apache-2.0 or MIT license. The README notes that MSSQL support was removed pending a full driver rewrite.