Refinery
github.com
- Free plan
- Windows
- macOS
- Linux
- Self-hosted
What Refinery is
Refinery is a SQL migration toolkit for Rust that runs migrations through a database connection provided by an application. Migrations can be embedded in Rust code or run with the refinery_cli command-line tool, and they can be written as SQL files or Rust modules whose migration function returns a String. The toolkit tracks applied migration versions and metadata, checking for missing or divergent migrations before running unapplied ones. Each migration uses its own transaction by default; grouped mode can put all migrations in one transaction. Migrations can also be baked into a binary, so separate files are not needed at deployment. The README lists postgres, tokio-postgres, mysql, mysql_async, rusqlite and tiberius drivers; SQLx can be used with a Config that implements Migrate. Driver selection uses features, while additional drivers may be maintained in external repositories. Versions default to signed 32-bit integers; 64-bit versions require enabling the int8-versions feature before using the database. Refinery is free, open source, and MIT-licensed. To reverse a change, users write a new migration that applies the reversal.
Who it suits
Refinery suits Rust developers who need to manage database changes as SQL files or Rust modules. It also fits teams that want migrations embedded in an application binary or run through a command-line tool.
Good to know, and what to watch
- Supports SQL files and Rust migration modules.
- Tracks versions, metadata, and divergent migrations.
- Can bundle migrations into a binary.
- Lists several database drivers and SQLx support.
- Free and MIT-licensed.
- Rollback requires writing a reversing migration.
- 64-bit versions must be enabled before database use.
- Additional drivers may be maintained externally.
Plans
Every plan and priceRefinery
Open source
Getting started
- Open the public GitHub repository
- Add Refinery to a Rust project
- Select the database-driver features you need
- Write migrations as SQL files or Rust modules
- Embed migrations in Rust or run refinery_cli
- Provide a supported database connection and execute migrations
The verdict
Refinery offers Rust projects migration tracking, multiple migration formats, and transaction options. Plan for explicit reversing migrations and choose the version-width feature before using a database if 64-bit versions are needed.
Questions people ask
Is Refinery free?
Yes. The listed Refinery plan costs nothing, and the project is open source under the MIT License.
Which platforms can run Refinery?
The listed platforms are Linux, macOS, Windows, and self-hosted environments.
Which databases and drivers are supported?
The README lists postgres, tokio-postgres, mysql, mysql_async, rusqlite, and tiberius. SQLx can be used with a Config that implements Migrate.
Can migrations be embedded?
Yes. Migrations can be embedded in Rust code and built into a binary so separate migration files are unnecessary at deployment.
Does Refinery support rollback?
Yes, but reversing a migration requires creating a new migration that contains the changes needed to undo it.
What license covers the project?
Refinery is licensed under the MIT License and published as a public GitHub repository.
What the maker publishes
- Additional drivers
- The maintainers say limited bandwidth favors maintaining additional database drivers in external repositories; the README names Klickhouse as an example. source
- Embedded migrations
- The project can bake migrations into a binary so no additional files are needed when deployed. source
- License
- The project is licensed under the MIT License. source
- Migration formats
- Migrations can be SQL files or Rust modules with a migration function that returns a String. source
- Migration tracking
- Refinery records applied migration versions and metadata, then checks for divergent or missing migrations before executing unapplied ones. source
- Purpose
- Refinery is a SQL migration toolkit for Rust that runs migrations on a provided database connection. source
- Rollback
- To undo a migration, users must create a new migration and write the changes that reverse it. source
- Run modes
- Migrations can be embedded in Rust code or run through the refinery_cli command-line tool. source
- Rust support
- The project aims to support stable Rust, the previous Rust version, and nightly. source
- Source availability
- The project is published as a public GitHub repository. source
- SQLx
- The README says SQLx can be used by providing a Config that implements Migrate. source
- Supported drivers
- The README lists postgres, tokio-postgres, mysql, mysql_async, rusqlite, and tiberius as supported drivers. source
- Transactions
- By default, each migration runs in its own transaction; grouped mode can wrap all migrations in one transaction. source
- Version limit
- Migration versions default to signed 32-bit integers; the int8-versions feature enables 64-bit versions and must be enabled before use on a database. source
Checked against the maker's pages on 4 Oct 2026.