AutoBE
    Preparing search index...

    A single Prisma model (database table).

    interface IModel {
        description: string;
        foreignFields: IForeignField[];
        ginIndexes: IGinIndex[];
        name: string & SnakeCasePattern;
        plainFields: IPlainField[];
        plainIndexes: IPlainIndex[];
        primaryField: IPrimaryField;
        stance:
            | "actor"
            | "primary"
            | "subsidiary"
            | "snapshot"
            | "material"
            | "session";
        uniqueIndexes: IUniqueIndex[];
    }
    Index

    Properties

    description: string

    Finished Prisma documentation for this model. Include only business prose about the stored concept, lifecycle, ownership, and important relationships.

    foreignFields: IForeignField[]

    Foreign key fields establishing relationships to other models.

    ginIndexes: IGinIndex[]

    GIN indexes for PostgreSQL full-text search (trigram).

    name: string & SnakeCasePattern

    Final table/model name.

    Use a plural, snake_case, prefix-aware table name. When stance is "material", place the special mv_ prefix before the configured database prefix.

    plainFields: IPlainField[]

    Regular persisted data fields owned by this row, including values that a snapshot/history row intentionally captures at a point in time.

    Every model must include a non-null created_at datetime plain field. Mutable business rows also include non-null updated_at, while deleted_at is added only for soft-delete requirements. Current query/service output reconstructed from source rows belongs in prose or materialized views instead.

    plainIndexes: IPlainIndex[]

    Regular indexes for query performance.

    primaryField: IPrimaryField

    Primary key field (UUID).

    stance: "actor" | "primary" | "subsidiary" | "snapshot" | "material" | "session"

    Architectural role of this model, guiding API endpoint generation.

    • "primary": Core entity users manage independently (full CRUD APIs). Use when users need to create, search, or manage entities outside their parent context.
    • "actor": Authenticated user type with its own identity, credentials, and auth flow. Generates auth endpoints.
    • "session": Login session table belonging to exactly one actor. Append-only audit trail, managed via auth flows.
    • "subsidiary": Supporting entity managed through its parent, rarely needs standalone endpoints.
    • "snapshot": Point-in-time versioning record, typically append-only and read-only from user perspective.
    • "material": Read-only materialized query projection. The table name must start with mv_, and normal CRUD endpoints are not generated.
    uniqueIndexes: IUniqueIndex[]

    Unique indexes for data integrity constraints.