nullableIdColumnMysql
nullableIdColumnMysql<
Brand>(codec):MySqlCustomColumnBuilder<{columnType:"MySqlCustomColumn";data:Id<Brand> |null;dataType:"custom";driverParam:string|null;enumValues:undefined;name:""; }>
Defined in: src/adapters/drizzle.ts:254
Drizzle custom column type for a nullable Id<Brand> column in MySQL.
Behaves identically to idColumnMysql except that null and undefined
driver values are passed through as null rather than throwing. Use for
optional foreign keys, LEFT JOIN results, and any column that is
legitimately absent.
Column type is always text and cannot be overridden in MySQL.
Type Parameters
Section titled “Type Parameters”Brand extends string
Parameters
Section titled “Parameters”IdColumnCodec<Brand>
The brand-scoped codec used to parse values read from the database.
Returns
Section titled “Returns”MySqlCustomColumnBuilder<{ columnType: "MySqlCustomColumn"; data: Id<Brand> | null; dataType: "custom"; driverParam: string | null; enumValues: undefined; name: ""; }>
Example
Section titled “Example”import { nullableIdColumnMysql } from "@smonn/ids/drizzle";import { createTimestampId } from "@smonn/ids";
const usr = createTimestampId("usr");export const posts = mysqlTable("posts", { authorId: nullableIdColumnMysql(usr),});// posts.authorId is Id<"usr"> | null end-to-end