prorm API Reference
    Preparing search index...

    Interface AssociationForeignKeyOptions

    Foreign-key specifics for an association, when the defaults derived from the model names are not what you want.

    interface AssociationForeignKeyOptions {
        name?: string;
        allowNull?: boolean;
        validate?: ModelValidationOptions;
        compositeKey?: string[];
        constraintName?: string;
    }
    Index
    name?: string

    Custom name for the foreign key constraint

    allowNull?: boolean

    Allow null values in the foreign key column(s)

    Validation options for the foreign key column

    compositeKey?: string[]

    Composite foreign key - array of field names that make up the composite key. This is used when the foreign key consists of multiple columns.

    compositeKey: ['orderId', 'customerId']
    
    constraintName?: string

    Custom constraint name for the foreign key (alternative to 'name')