1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//! # prax-import
//!
//! Import schemas from Prisma, Diesel, and SeaORM to Prax ORM.
//!
//! This crate provides utilities to migrate existing Prisma, Diesel, and SeaORM schemas
//! to Prax's schema format, making it easy to switch ORMs or start using Prax
//! in existing projects.
//!
//! ## Features
//!
//! - **Prisma Import**: Parse Prisma schema files (`.prisma`) and convert to Prax
//! - **Diesel Import**: Parse Diesel schema files (Rust code with `table!` macros) and convert to Prax
//! - **SeaORM Import**: Parse SeaORM entity files (Rust code with `DeriveEntityModel`) and convert to Prax
//! - **Type Mapping**: Automatic conversion of types between ORMs
//! - **Relation Mapping**: Preserve relations and foreign keys
//! - **Attribute Mapping**: Convert attributes and constraints
//!
//! ## Quick Start
//!
//! ### Import from Prisma
//!
//! ```rust,no_run
//! use 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).unwrap();
//! println!("Converted {} models", prax_schema.models.len());
//! ```
//!
//! ### Import from Diesel
//!
//! ```rust,no_run
//! 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).unwrap();
//! println!("Converted {} models", prax_schema.models.len());
//! ```
//!
//! ### Import from SeaORM
//!
//! ```rust,no_run
//! 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,
//! pub email: String,
//! pub name: Option<String>,
//! }
//!
//! #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
//! pub enum Relation {}
//! "#;
//!
//! let prax_schema = import_seaorm_entity(seaorm_entity).unwrap();
//! println!("Converted {} models", prax_schema.models.len());
//! ```
//!
//! ## Type Mappings
//!
//! ### Prisma to Prax
//!
//! | Prisma Type | Prax Type |
//! |-------------|-----------|
//! | `Int` | `Int` |
//! | `BigInt` | `BigInt` |
//! | `Float` | `Float` |
//! | `Decimal` | `Decimal` |
//! | `String` | `String` |
//! | `Boolean` | `Boolean` |
//! | `DateTime` | `DateTime` |
//! | `Json` | `Json` |
//! | `Bytes` | `Bytes` |
//!
//! ### Diesel to Prax
//!
//! | 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` |
pub use ;
/// Prelude module for convenient imports.