Documentation
    Preparing search index...

    Class SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>Abstract

    Type Parameters

    • T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>
    • TRuntimeConfig extends object = object
    • TTypeConfig extends object = object
    • TExtraConfig extends ColumnBuilderExtraConfig = object

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Type Parameters

      • T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>
      • TRuntimeConfig extends object = object
      • TTypeConfig extends object = object
      • TExtraConfig extends ColumnBuilderExtraConfig = object

      Parameters

      • name: T["name"]
      • dataType: T["dataType"]
      • columnType: T["columnType"]

      Returns SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>

    Properties

    _: {
        [K in string | number | symbol]: (
            {
                brand: "ColumnBuilder";
                columnType: T["columnType"];
                data: T["data"];
                dataType: T["dataType"];
                driverParam: T["driverParam"];
                enumValues: T["enumValues"];
                generated: T extends { generated: G }
                    ? G extends undefined ? unknown : G
                    : unknown;
                hasDefault: T extends { hasDefault: U } ? U : boolean;
                identity: T extends { identity: U } ? U : unknown;
                name: T["name"];
                notNull: T extends { notNull: U } ? U : boolean;
            } & TTypeConfig & { dialect: "sqlite" }
        )[K]
    }
    $default: (
        fn: () => | SQL<unknown>
        | (
            {
                [K in string
                | number
                | symbol]: (
                    {
                        brand: "ColumnBuilder";
                        columnType: T["columnType"];
                        data: T["data"];
                        dataType: T["dataType"];
                        driverParam: T["driverParam"];
                        enumValues: T["enumValues"];
                        generated: T extends { generated: G }
                            ? G extends undefined ? unknown : G
                            : unknown;
                        hasDefault: T extends { hasDefault: U } ? U : boolean;
                        identity: T extends { identity: U } ? U : unknown;
                        name: T["name"];
                        notNull: T extends { notNull: U } ? U : boolean;
                    } & TTypeConfig & { dialect: "sqlite" }
                )[K]
            } extends { $type: U }
                ? U
                : {
                    [K in string | number | symbol]: (
                        {
                            brand: "ColumnBuilder";
                            columnType: T["columnType"];
                            data: T["data"];
                            dataType: T["dataType"];
                            driverParam: T["driverParam"];
                            enumValues: T["enumValues"];
                            generated: T extends { generated: ... }
                                ? (...) extends (...) ? (...) : (...)
                                : unknown;
                            hasDefault: T extends { hasDefault: ... } ? U : boolean;
                            identity: T extends { identity: ... } ? U : unknown;
                            name: T["name"];
                            notNull: T extends { notNull: ... } ? U : boolean;
                        } & TTypeConfig & { dialect: "sqlite" }
                    )[K]
                }["data"]
        ),
    ) => HasRuntimeDefault<
        HasDefault<
            SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>,
        >,
    >

    Alias for $defaultFn.

    $onUpdate: (
        fn: () => | SQL<unknown>
        | (
            {
                [K in string
                | number
                | symbol]: (
                    {
                        brand: "ColumnBuilder";
                        columnType: T["columnType"];
                        data: T["data"];
                        dataType: T["dataType"];
                        driverParam: T["driverParam"];
                        enumValues: T["enumValues"];
                        generated: T extends { generated: G }
                            ? G extends undefined ? unknown : G
                            : unknown;
                        hasDefault: T extends { hasDefault: U } ? U : boolean;
                        identity: T extends { identity: U } ? U : unknown;
                        name: T["name"];
                        notNull: T extends { notNull: U } ? U : boolean;
                    } & TTypeConfig & { dialect: "sqlite" }
                )[K]
            } extends { $type: U }
                ? U
                : {
                    [K in string | number | symbol]: (
                        {
                            brand: "ColumnBuilder";
                            columnType: T["columnType"];
                            data: T["data"];
                            dataType: T["dataType"];
                            driverParam: T["driverParam"];
                            enumValues: T["enumValues"];
                            generated: T extends { generated: ... }
                                ? (...) extends (...) ? (...) : (...)
                                : unknown;
                            hasDefault: T extends { hasDefault: ... } ? U : boolean;
                            identity: T extends { identity: ... } ? U : unknown;
                            name: T["name"];
                            notNull: T extends { notNull: ... } ? U : boolean;
                        } & TTypeConfig & { dialect: "sqlite" }
                    )[K]
                }["data"]
        ),
    ) => HasDefault<
        SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>,
    >

    Alias for $onUpdateFn.

    config: ColumnBuilderRuntimeConfig<T["data"], TRuntimeConfig>
    "[entityKind]": string

    Methods

    • Adds a dynamic default value to the column. The function will be called when the row is inserted, and the returned value will be used as the column value.

      Note: This value does not affect the drizzle-kit behavior, it is only used at runtime in drizzle-orm.

      Parameters

      • fn: () => | SQL<unknown>
        | (
            {
                [K in string
                | number
                | symbol]: (
                    {
                        brand: "ColumnBuilder";
                        columnType: T["columnType"];
                        data: T["data"];
                        dataType: T["dataType"];
                        driverParam: T["driverParam"];
                        enumValues: T["enumValues"];
                        generated: T extends { generated: G }
                            ? G extends undefined ? unknown : G
                            : unknown;
                        hasDefault: T extends { hasDefault: U } ? U : boolean;
                        identity: T extends { identity: U } ? U : unknown;
                        name: T["name"];
                        notNull: T extends { notNull: U } ? U : boolean;
                    } & TTypeConfig & { dialect: "sqlite" }
                )[K]
            } extends { $type: U }
                ? U
                : {
                    [K in string | number | symbol]: (
                        {
                            brand: "ColumnBuilder";
                            columnType: T["columnType"];
                            data: T["data"];
                            dataType: T["dataType"];
                            driverParam: T["driverParam"];
                            enumValues: T["enumValues"];
                            generated: T extends { generated: G }
                                ? G extends undefined ? unknown : G
                                : unknown;
                            hasDefault: T extends { hasDefault: U } ? U : boolean;
                            identity: T extends { identity: U } ? U : unknown;
                            name: T["name"];
                            notNull: T extends { notNull: U } ? U : boolean;
                        } & TTypeConfig & { dialect: "sqlite" }
                    )[K]
                }["data"]
        )

      Returns HasRuntimeDefault<
          HasDefault<
              SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>,
          >,
      >

    • Adds a dynamic update value to the column. The function will be called when the row is updated, and the returned value will be used as the column value if none is provided. If no default (or $defaultFn) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.

      Note: This value does not affect the drizzle-kit behavior, it is only used at runtime in drizzle-orm.

      Parameters

      • fn: () => | SQL<unknown>
        | (
            {
                [K in string
                | number
                | symbol]: (
                    {
                        brand: "ColumnBuilder";
                        columnType: T["columnType"];
                        data: T["data"];
                        dataType: T["dataType"];
                        driverParam: T["driverParam"];
                        enumValues: T["enumValues"];
                        generated: T extends { generated: G }
                            ? G extends undefined ? unknown : G
                            : unknown;
                        hasDefault: T extends { hasDefault: U } ? U : boolean;
                        identity: T extends { identity: U } ? U : unknown;
                        name: T["name"];
                        notNull: T extends { notNull: U } ? U : boolean;
                    } & TTypeConfig & { dialect: "sqlite" }
                )[K]
            } extends { $type: U }
                ? U
                : {
                    [K in string | number | symbol]: (
                        {
                            brand: "ColumnBuilder";
                            columnType: T["columnType"];
                            data: T["data"];
                            dataType: T["dataType"];
                            driverParam: T["driverParam"];
                            enumValues: T["enumValues"];
                            generated: T extends { generated: G }
                                ? G extends undefined ? unknown : G
                                : unknown;
                            hasDefault: T extends { hasDefault: U } ? U : boolean;
                            identity: T extends { identity: U } ? U : unknown;
                            name: T["name"];
                            notNull: T extends { notNull: U } ? U : boolean;
                        } & TTypeConfig & { dialect: "sqlite" }
                    )[K]
                }["data"]
        )

      Returns HasDefault<SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>>

    • Adds a default <value> clause to the column definition.

      Affects the insert model of the table - columns with default are optional on insert.

      If you need to set a dynamic default value, use $defaultFn instead.

      Parameters

      • value:
            | SQL<unknown>
            | (
                {
                    [K in string
                    | number
                    | symbol]: (
                        {
                            brand: "ColumnBuilder";
                            columnType: T["columnType"];
                            data: T["data"];
                            dataType: T["dataType"];
                            driverParam: T["driverParam"];
                            enumValues: T["enumValues"];
                            generated: T extends { generated: G }
                                ? G extends undefined ? unknown : G
                                : unknown;
                            hasDefault: T extends { hasDefault: U } ? U : boolean;
                            identity: T extends { identity: U } ? U : unknown;
                            name: T["name"];
                            notNull: T extends { notNull: U } ? U : boolean;
                        } & TTypeConfig & { dialect: "sqlite" }
                    )[K]
                } extends { $type: U }
                    ? U
                    : {
                        [K in string | number | symbol]: (
                            {
                                brand: "ColumnBuilder";
                                columnType: T["columnType"];
                                data: T["data"];
                                dataType: T["dataType"];
                                driverParam: T["driverParam"];
                                enumValues: T["enumValues"];
                                generated: T extends { generated: G }
                                    ? G extends undefined ? unknown : G
                                    : unknown;
                                hasDefault: T extends { hasDefault: U } ? U : boolean;
                                identity: T extends { identity: U } ? U : unknown;
                                name: T["name"];
                                notNull: T extends { notNull: U } ? U : boolean;
                            } & TTypeConfig & { dialect: "sqlite" }
                        )[K]
                    }["data"]
            )

      Returns HasDefault<SQLiteColumnBuilder<T, TRuntimeConfig, TTypeConfig, TExtraConfig>>