AutoBE
    Preparing search index...

    Interface representing a foreign key field that establishes relationships between models.

    Foreign keys create associations between models, enabling relational data modeling. They can represent 1:1, 1:N, or participate in M:N relationships through junction tables.

    interface IForeignField {
        description: string;
        name: string & SnakePattern;
        nullable: boolean;
        relation: IRelation;
        type: "uuid";
        unique: boolean;
    }
    Index

    Properties

    description: string

    Description explaining the purpose and target of this foreign key relationship.

    Should reference the target model using format: "Target model's {@\link ModelName.id}" Examples: "Belonged customer's {@\link shopping_customers.id}" May include additional context about the relationship's business meaning.

    IMPORTANT: Description must be written in English.

    name: string & SnakePattern

    Name of the foreign key field.

    MUST use snake_case naming convention. Follows convention: "{target_model_name_without_prefix}_id" Examples: "shopping_customer_id", "bbs_article_id", "attachment_file_id" For self-references: "parent_id" (e.g., in hierarchical structures)

    nullable: boolean

    Whether this foreign key can be null (optional relationship).

    True: Relationship is optional, foreign key can be null false: Relationship is required, foreign key cannot be null Reflects business rules about mandatory vs optional associations.

    relation: IRelation

    Prisma relation configuration defining the association details.

    Specifies how this foreign key connects to the target model, including relation name, target model, and target field. This configuration is used to generate the appropriate Prisma relation directive in the schema.

    type: "uuid"

    Data type of the foreign key field.

    Always "uuid" to match the primary key type of referenced models. Ensures referential integrity and consistency across the schema.

    unique: boolean

    Whether this foreign key has a unique constraint.

    True: Creates a 1:1 relationship (e.g., user profile, order publish details) false: Allows 1:N relationship (e.g., customer to multiple orders) Used for enforcing business rules about relationship cardinality.