Documentation
    Preparing search index...

    Class SQLiteBaseIntegerBuilder<T, TRuntimeConfig>Abstract

    Type Parameters

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

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

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

      Parameters

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

      Returns SQLiteBaseIntegerBuilder<T, TRuntimeConfig>

    Properties

    _: {
        brand: "ColumnBuilder";
        columnType: T["columnType"];
        data: T["data"];
        dataType: T["dataType"];
        dialect: "sqlite";
        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;
    }
    $default: (
        fn: () => SQL<unknown> | T["data"],
    ) => HasRuntimeDefault<
        HasDefault<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>>,
    >

    Alias for $defaultFn.

    $onUpdate: (
        fn: () => SQL<unknown> | T["data"],
    ) => HasDefault<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>>

    Alias for $onUpdateFn.

    config: ColumnBuilderRuntimeConfig<
        T["data"],
        TRuntimeConfig & { autoIncrement: boolean },
    >
    "[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> | T["data"]

      Returns HasRuntimeDefault<HasDefault<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>>>

    • 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> | T["data"]

      Returns HasDefault<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>>

    • Changes the data type of the column. Commonly used with json columns. Also, useful for branded types.

      Type Parameters

      • TType

      Returns $Type<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>, TType>

      const users = pgTable('users', {
      id: integer('id').$type<UserId>().primaryKey(),
      details: json('details').$type<UserDetails>().notNull(),
      });
    • 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> | T["data"]

      Returns HasDefault<SQLiteBaseIntegerBuilder<T, TRuntimeConfig>>

    • Parameters

      • Optionalname: string

      Returns this