prax-orm 0.12.0

A next-generation, type-safe ORM for Rust inspired by Prisma
Documentation
// Regression fixture for the schema-path relation_helpers bug.
// Two models with a bidirectional relation; prax_schema! must emit
// resolvable cross-model module paths (crate::<model>::<Model>).

model Author {
    id    Int    @id @auto
    name  String
    posts Post[] @relation(fields: [id], references: [author_id])
}

model Post {
    id        Int    @id @auto
    title     String
    author_id Int
    author    Author? @relation(fields: [author_id], references: [id])
}

// Multi-word model name: exercises snake_case module naming (`blog_post`)
// and PascalCase struct/path resolution (`super::author::Author`).
model BlogPost {
    id        Int     @id @auto
    title     String
    author_id Int
    author    Author? @relation(fields: [author_id], references: [id])
}

// Self-relation: the relation target is the model itself. The field names
// (`parent`, `children`) deliberately differ from the model's own module
// name (`category`) so the self-relation collision guard does not fire —
// `super::category::Category` must resolve back to this model.
model Category {
    id        Int        @id @auto
    name      String
    parent_id Int
    parent    Category?  @relation(fields: [parent_id], references: [id])
    children  Category[] @relation(fields: [id], references: [parent_id])
}