new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Drizzle ORM · all subjects

singlestore/column-types

19 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

varchar and text enum configuration

Both varchar and text column types can define an enum option with an array of string values to infer insert and select types. The enum option does not enforce runtime value checking. Example: varchar({ length: 6, enum: ["value1", "value2"] }), text({ enum: ["value1", "value2"] }).

SingleStore integer column types overview

SingleStore supports the following integer column types: int (signed integer stored in 0, 1, 2, 3, 4, 6, or 8 bytes depending on value magnitude), tinyint, smallint, mediumint, bigint, and serial. The serial type is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.

bigint column with mode and unsigned options

The bigint column type accepts mode ('number' or 'bigint') and unsigned (boolean) options. Example: bigint({ mode: 'number' }), bigint({ mode: 'bigint', unsigned: true }).

real column with precision and scale

The real column type optionally accepts precision and scale parameters. Example: real({ precision: 1 }), real({ precision: 1, scale: 1 }).

decimal column with precision, scale, and mode

The decimal column type accepts precision, scale, and mode options. The scale parameter can be up to 30. Mode can be 'number' or 'bigint'. Example: decimal({ scale: 30, mode: 'number' }), decimal({ precision: 1, scale: 1 }).

double column with precision and scale

The double column type optionally accepts precision and scale parameters. Example: double({ precision: 1 }), double({ precision: 1, scale: 1 }).

datetime and timestamp column modes

The datetime and timestamp column types accept a mode option that can be 'date' or 'string', determining how the value is represented in TypeScript.

timestamp defaultNow method

The timestamp column type has a defaultNow() method that sets the default value to the current time. This generates DEFAULT (now()) in SQL.

json column type inference with $type

The json column type supports the $type() method for compile-time type inference of the JSON structure. Example: json().$type<{ foo: string }>(), json().$type<string[]>(). The $type method does not enforce runtime value checking but provides compile-time protection for default values, insert and select schemas.

singlestoreEnum type declaration

SingleStore supports enum columns using the singlestoreEnum function with an array of string values. Example: singlestoreEnum(['unknown', 'known', 'popular']) generates enum('unknown','known','popular') in SQL.

notNull constraint on columns

Columns can have a notNull() method applied to enforce a NOT NULL constraint in SQL, preventing NULL values from being stored.

Column default value with default method

The default() method specifies a static default value for a column. The default value is used when no value is provided during an INSERT operation. If no DEFAULT clause is specified, the default value is NULL. Example: int().default(3) generates DEFAULT 3 in SQL.

$onUpdateFn runtime update value generation

$onUpdateFn() and $onUpdate() are aliases that allow generating values at runtime during update queries. If no default or $defaultFn is provided, the function is also called on insert. This is only used at runtime in drizzle-orm and does not affect drizzle-kit behavior. Example: text().$type<string | null>().$onUpdate(() => null).

Primary key constraint on columns

The primaryKey() method sets a column as the primary key, which generates PRIMARY KEY NOT NULL in SQL.

Auto increment on columns

The autoincrement() method enables auto-increment behavior on a column, generating AUTO_INCREMENT in SQL.

Column name aliases and casing parameter

Column names are generated from TypeScript keys by default. Database column name aliases can be used if needed, and the casing parameter can define a mapping strategy for column naming in Drizzle.

int column type import and usage example

The int column type is imported from 'drizzle-orm/singlestore-core' and used within singlestoreTable. Example: const table = singlestoreTable('table', { int: int() }).

varbinary column with length parameter

The varbinary column type accepts a length parameter to specify the maximum byte length. Example: varbinary({ length: 2 }) generates varbinary(2) in SQL.

varchar column with length parameter

The varchar column type requires a length parameter to specify the maximum character length. Example: varchar({ length: 2 }) generates varchar(2) in SQL.

Give your agent this brain