API 参考
    正在准备搜索索引...

    Table's column options.

    interface TableColumnOptions {
        asExpression?: string;
        charset?: string;
        collation?: string;
        comment?: string;
        default?: any;
        enum?: string[];
        enumName?: string;
        foreignKeyConstraintName?: string;
        generatedIdentity?: "ALWAYS" | "BY DEFAULT";
        generatedType?: "VIRTUAL" | "STORED";
        generationStrategy?: "uuid" | "rowid" | "increment" | "identity";
        isArray?: boolean;
        isGenerated?: boolean;
        isNullable?: boolean;
        isPrimary?: boolean;
        isUnique?: boolean;
        length?: string;
        name: string;
        onUpdate?: string;
        precision?: null | number;
        primaryKeyConstraintName?: string;
        scale?: number;
        spatialFeatureType?: string;
        srid?: number;
        type: string;
        unsigned?: boolean;
        width?: number;
        zerofill?: boolean;
    }
    索引

    属性

    asExpression?: string

    Generated column expression.

    charset?: string

    Defines column character set.

    collation?: string

    Defines column collation.

    comment?: string

    Column's comment.

    default?: any

    Column's default value.

    enum?: string[]

    Array of possible enumerated values.

    enumName?: string

    Exact name of enum

    foreignKeyConstraintName?: string

    If this column is foreign key then this specifies the name for it.

    generatedIdentity?: "ALWAYS" | "BY DEFAULT"

    Identity column type. Supports only in Postgres 10+.

    generatedType?: "VIRTUAL" | "STORED"

    Generated column type.

    generationStrategy?: "uuid" | "rowid" | "increment" | "identity"

    Specifies generation strategy if this column will use auto increment.

    isArray?: boolean

    Indicates if column stores array.

    isGenerated?: boolean

    Indicates if column is auto-generated sequence.

    isNullable?: boolean

    Indicates if column is NULL, or is NOT NULL in the database.

    isPrimary?: boolean

    Indicates if column is a primary key.

    isUnique?: boolean

    Indicates if column has unique value.

    length?: string

    Column type's length. Used only on some column types. For example type = "string" and length = "100" means that ORM will create a column with type varchar(100).

    name: string

    Column name.

    onUpdate?: string

    ON UPDATE trigger. Works only for MySQL.

    precision?: null | number

    The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum number of digits that are stored for the values.

    primaryKeyConstraintName?: string

    If this column is primary key then this specifies the name for it.

    scale?: number

    The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number of digits to the right of the decimal point and must not be greater than precision.

    spatialFeatureType?: string

    Spatial Feature Type (Geometry, Point, Polygon, etc.)

    srid?: number

    SRID (Spatial Reference ID (EPSG code))

    type: string

    Column type.

    unsigned?: boolean

    Puts UNSIGNED attribute on to numeric column. Works only for MySQL.

    width?: number

    Column type's display width. Used only on some column types in MySQL. For example, INT(4) specifies an INT with a display width of four digits.

    zerofill?: boolean

    Puts ZEROFILL attribute on to numeric column. Works only for MySQL. If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column