prorm API Reference
    Preparing search index...

    Interface ColumnDefinition

    One column in a CREATE TABLE or ALTER TABLE: its type, nullability, default, and key or reference membership.

    interface ColumnDefinition {
        type: DataType;
        allowNull?: boolean;
        defaultValue?: any;
        primaryKey?: boolean;
        autoIncrement?: boolean;
        unique?: string | boolean;
        references?: {
            table: string;
            field: string | string[];
            onDelete?: string;
            onUpdate?: string;
        };
        comment?: string;
        charset?: string;
        collate?: string;
        sparse?: boolean;
        invisible?: boolean;
    }
    Index
    type: DataType
    allowNull?: boolean
    defaultValue?: any
    primaryKey?: boolean
    autoIncrement?: boolean
    unique?: string | boolean
    references?: {
        table: string;
        field: string | string[];
        onDelete?: string;
        onUpdate?: string;
    }
    comment?: string
    charset?: string

    Column-level character set (MySQL/MariaDB, e.g. 'utf8mb4')

    collate?: string

    Column-level collation (MySQL/MariaDB, e.g. 'utf8mb4_unicode_ci')

    sparse?: boolean

    SQL Server: mark the column as SPARSE. Sparse columns optimize storage for columns whose values are NULL most of the time, at the cost of extra storage overhead for non-NULL values. Only valid on nullable columns — SQL Server requires SPARSE columns to allow NULL.

    invisible?: boolean

    Marks the column INVISIBLE (MySQL 8.0+ / MariaDB 10.3+). Invisible columns are hidden from SELECT * and don't require a value on INSERT, which makes them useful for zero-downtime column rollout: add the column invisible, backfill it, then flip it visible once ready. Columns are visible by default (false/undefined).