prorm API Reference
    Preparing search index...

    Interface ModelOptions

    Per-model configuration: the table it maps to, whether timestamps and soft deletes are managed, and how attribute names are converted to column names.

    interface ModelOptions {
        tableName?: string;
        schema?: string;
        schemaDelimiter?: string;
        timestamps?: boolean;
        createdAt?: string | false;
        updatedAt?: string | false;
        deletedAt?: string | false;
        paranoid?: boolean;
        preserveDeletedAt?: boolean;
        underscored?: boolean;
        freezeTableName?: boolean;
        hooks?: ModelHooks;
        scopes?: Record<string, ScopeOptions>;
        defaultScope?: ScopeOptions;
        validate?: ModelValidationOptions;
        primaryKey?: string | string[];
        indexes?: IndexOptions[];
        constraints?: ConstraintOptions[];
        classMethods?: Record<string, Function>;
        instanceMethods?: Record<string, Function>;
        hidden?: Record<string, boolean>;
        virtualFields?: boolean;
        engine?: string;
        charset?: string;
        collate?: string;
        comment?: string;
        initialAutoIncrement?: number;
        rowFormat?: string;
        uniqueKeys?: UniqueKeyOptions[];
        uniqueKeysLegacy?: Record<string, string[]>;
        tablespace?: string;
        inherit?: string;
        partitionBy?: string;
        validateOnInsert?: boolean;
        validateOnUpdate?: boolean;
        skipValidations?: boolean;
    }

    Hierarchy (View Summary)

    Index
    tableName?: string
    schema?: string

    Schema to use for this model (PostgreSQL) or database (MySQL)

    schemaDelimiter?: string

    Schema delimiter for table name generation (default: '.')

    timestamps?: boolean
    createdAt?: string | false
    updatedAt?: string | false
    deletedAt?: string | false
    paranoid?: boolean
    preserveDeletedAt?: boolean
    underscored?: boolean
    freezeTableName?: boolean
    hooks?: ModelHooks
    scopes?: Record<string, ScopeOptions>
    defaultScope?: ScopeOptions
    primaryKey?: string | string[]

    Primary key field(s) - supports both single field (string) and composite keys (string[])

    indexes?: IndexOptions[]
    constraints?: ConstraintOptions[]
    classMethods?: Record<string, Function>
    instanceMethods?: Record<string, Function>
    hidden?: Record<string, boolean>
    virtualFields?: boolean
    engine?: string

    MySQL/MariaDB storage engine (e.g., 'InnoDB', 'MyISAM')

    charset?: string

    Character set for the table (e.g., 'utf8mb4')

    collate?: string

    Collation for the table (e.g., 'utf8mb4_unicode_ci')

    comment?: string

    Comment for the table

    initialAutoIncrement?: number

    Initial auto-increment value for the table

    rowFormat?: string

    Row format for MySQL/MariaDB (e.g., 'DYNAMIC', 'FIXED', 'COMPRESSED')

    uniqueKeys?: UniqueKeyOptions[]

    Unique keys to create with the table - supports both simple and composite keys

    uniqueKeysLegacy?: Record<string, string[]>

    Legacy unique keys format (deprecated - use UniqueKeyOptions instead)

    tablespace?: string

    PostgreSQL tablespace

    inherit?: string

    PostgreSQL: inherit from parent table

    partitionBy?: string

    PostgreSQL: partition by clause

    validateOnInsert?: boolean

    Validate on create (default: true)

    validateOnUpdate?: boolean

    Validate on update (default: true)

    skipValidations?: boolean

    Skip validations (default: false)