| Crates.io | prax-import |
| lib.rs | prax-import |
| version | 0.5.0 |
| created_at | 2026-01-07 18:39:04.583453+00 |
| updated_at | 2026-01-07 18:39:04.583453+00 |
| description | Import schemas from Prisma, Diesel, and SeaORM to Prax ORM |
| homepage | https://github.com/pegasusheavy/prax-orm |
| repository | https://github.com/pegasusheavy/prax-orm |
| max_upload_size | |
| id | 2028806 |
| size | 137,564 |
Import schemas from Prisma, Diesel, and SeaORM to Prax ORM.
.prisma) and convert to Praxtable! macros) and convert to PraxDeriveEntityModel) and convert to Prax✅ Production Ready - Full support for Prisma, Diesel, and SeaORM schema imports with comprehensive test coverage.
prax import commanduse prax_import::prisma::import_prisma_schema;
let prisma_schema = r#"
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
createdAt DateTime @default(now())
}
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
authorId Int
author User @relation(fields: [authorId], references: [id])
}
"#;
let prax_schema = import_prisma_schema(prisma_schema)?;
// Write to .prax file
std::fs::write("schema.prax", format!("{}", prax_schema))?;
use prax_import::diesel::import_diesel_schema;
let diesel_schema = r#"
table! {
users (id) {
id -> Int4,
email -> Varchar,
name -> Nullable<Varchar>,
created_at -> Timestamp,
}
}
table! {
posts (id) {
id -> Int4,
title -> Varchar,
content -> Nullable<Text>,
published -> Bool,
author_id -> Int4,
}
}
joinable!(posts -> users (author_id));
"#;
let prax_schema = import_diesel_schema(diesel_schema)?;
// Write to .prax file
std::fs::write("schema.prax", format!("{}", prax_schema))?;
use prax_import::seaorm::import_seaorm_entity;
let seaorm_entity = r#"
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "users")]
pub struct Model {
#[sea_orm(primary_key, auto_increment)]
pub id: i32,
#[sea_orm(unique)]
pub email: String,
pub name: Option<String>,
pub created_at: DateTime,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::post::Entity")]
Posts,
}
"#;
let prax_schema = import_seaorm_entity(seaorm_entity)?;
// Write to .prax file
std::fs::write("schema.prax", format!("{}", prax_schema))?;
# Import from Prisma
prax import --from prisma --input schema.prisma --output schema.prax
# Import from Diesel
prax import --from diesel --input schema.rs --output schema.prax
# Import from SeaORM
prax import --from sea-orm --input entity/user.rs --output schema.prax
# Print to stdout instead of file
prax import --from prisma --input schema.prisma --print
# Force overwrite existing file
prax import --from diesel --input schema.rs --output schema.prax --force
| Prisma Type | Prax Type |
|---|---|
Int |
Int |
BigInt |
BigInt |
Float |
Float |
Decimal |
Decimal |
String |
String |
Boolean |
Boolean |
DateTime |
DateTime |
Json |
Json |
Bytes |
Bytes |
| Diesel Type | Prax Type |
|---|---|
Int4 |
Int |
Int8 |
BigInt |
Float4, Float8 |
Float |
Numeric |
Decimal |
Varchar, Text |
String |
Bool |
Boolean |
Timestamp |
DateTime |
Json, Jsonb |
Json |
Bytea |
Bytes |
| SeaORM Type | Prax Type |
|---|---|
i32, i64 |
Int |
f32, f64 |
Float |
String |
String |
bool |
Boolean |
DateTime |
DateTime |
Date |
Date |
Time |
Time |
Decimal |
Decimal |
serde_json::Value |
Json |
Vec<u8> |
Bytes |
Uuid |
Uuid |
The import crate is highly optimized for performance:
Recent optimizations include regex compilation caching, resulting in 1.4-2.3x speedup for Prisma and Diesel imports.
See BENCHMARKS.md for detailed performance metrics.
Run the test suite:
# Test all import functionality
cargo test -p prax-import --all-features
# Test specific ORM import
cargo test -p prax-import --features prisma
cargo test -p prax-import --features diesel
cargo test -p prax-import --features seaorm
Run performance benchmarks:
# Run all benchmarks
cargo bench -p prax-import --all-features
# View HTML reports
open target/criterion/report/index.html
Contributions are welcome! To add support for a new ORM:
src/<orm_name>/src/<orm_name>/types.rssrc/<orm_name>/parser.rssrc/converter.rsprax-cli/src/commands/import.rsDual-licensed under MIT or Apache-2.0, matching the main Prax ORM project.