Documentation
    Preparing search index...

    Interface AttributeToSqlColumn

    The column definition accepted by attributeToSql.

    This is deliberately wider than NormalizedAttributeOptions: the same methods are also called with the output of describeTable, where type is a raw SQL string, and with hand-written definitions from migrations. Not every dialect honours every property.

    interface AttributeToSqlColumn {
        after?: string;
        allowNull?: boolean;
        autoIncrement?: boolean;
        autoIncrementIdentity?: boolean;
        columnName?: string;
        comment?: string | null;
        defaultValue?: unknown;
        field?: string;
        first?: boolean;
        initialAutoIncrement?: string | number;
        Model?: { tableName: string };
        onDelete?: string;
        onUpdate?: string;
        primaryKey?: boolean;
        references?: AttributeToSqlReferences;
        type: NormalizedDataType;
        unique?: string | boolean;
    }
    Index
    after?: string

    mariadb, mysql, snowflake and ibmi only

    allowNull?: boolean
    autoIncrement?: boolean
    autoIncrementIdentity?: boolean
    columnName?: string
    comment?: string | null
    defaultValue?: unknown
    field?: string

    The name of the column. attributeToSql needs it to build CHECK constraints, foreign key constraint names and column comments.

    first?: boolean

    mariadb, mysql, snowflake and ibmi only

    initialAutoIncrement?: string | number
    Model?: { tableName: string }

    The model the column belongs to, when it comes from one. mssql and oracle read it to detect a column that references its own table.

    onDelete?: string
    onUpdate?: string
    primaryKey?: boolean
    unique?: string | boolean