prorm API Reference
    Preparing search index...

    Interface AttributeOptions

    One column of a model: its type, nullability, default, key membership and the name it maps to in the database.

    interface AttributeOptions {
        type: DataType;
        allowNull?: boolean;
        defaultValue?: any;
        primaryKey?: boolean;
        unique?: string | boolean | { name: string; msg?: string };
        uniqueKey?: string;
        references?: ReferenceOptions;
        autoIncrement?: boolean;
        comment?: string;
        validate?: ModelValidationOptions;
        field?: string;
        get?: () => any;
        set?: (value: any) => void;
        hidden?: boolean;
        virtual?: boolean;
    }
    Index
    type: DataType
    allowNull?: boolean
    defaultValue?: any
    primaryKey?: boolean
    unique?: string | boolean | { name: string; msg?: string }

    Unique constraint on this field

    • true: auto-generate constraint name
    • string: use as constraint name
    • { name: string, msg?: string }: custom name with optional error message
    uniqueKey?: string

    Unique key name for this attribute - used to group with other fields for composite unique constraints. When multiple fields share the same uniqueKey, they form a composite unique constraint. Example: { uniqueKey: 'uq_org_email' } on orgId and email fields creates a composite unique constraint.

    references?: ReferenceOptions
    autoIncrement?: boolean
    comment?: string
    field?: string
    get?: () => any
    set?: (value: any) => void
    hidden?: boolean
    virtual?: boolean