FluxForge
A database schema converter and migration engine for MySQL and PostgreSQL written in Rust.
Features
- Schema Extraction: Extract complete database schemas including tables, columns and indices (foreign keys are not yet supported)
- Type Mapping: Configurable type conversion between MySQL and PostgreSQL with built-in sensible defaults
- Data Replication: Stream and replicate data efficiently with chunked transfers and progress tracking
- Verification: Optional row-by-row verification to ensure data integrity after migration
- Dependency Resolution: Automatic topological sorting of tables based on foreign key relationships
- Dual Mode: Use as a standalone CLI tool or integrate as a library in your Rust projects
- Supported Migrations:
- MySQL → PostgreSQL ✅
- MySQL → MySQL ✅
- PostgreSQL → PostgreSQL ✅
Installation
As a Library
Add FluxForge to your Cargo.toml:
[]
= "0.3.0"
As a Standalone Binary
Install via cargo:
Usage
As a Library
use ;
async
As a CLI Tool
Extract Schema to JSON
Extract a database schema into an intermediate JSON format:
Migrate Schema Only
Apply schema changes without transferring data:
Or migrate from a previously extracted schema file:
Full Replication (Schema + Data)
Replicate both schema and data from source to target:
Note: The target database must be empty for replication to proceed (data loss protection).
Configuration File Example
Create a mapping.toml file to customize type mappings and transformation rules:
[]
= "integer"
= "smallint"
= "double precision"
= "timestamp"
= "bytea"
[]
= true
[]
= "jsonb"
= "timestamptz"
The "examples" folder contains three suggested configuration files:
mysql2postgres.toml: For MySQL to PostgreSQLmysql2mysql.toml: For MySQL to MySQLpostgres2postgres.toml: For PostgreSQL to PostgreSQL
The settings from mysql2postgres.toml are included in the executable standalone binary as default and are used if no mapping file is selected with --config.
Documentation
Full API documentation is available on docs.rs/fluxforge.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Minimum Supported Rust Version (MSRV)
This crate requires Rust 1.92 or later.
About Us
FluxForge development is sponsored and led by INS GmbH
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.