Skip to content

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.

Brand extends string

IdColumnCodec<Brand>

The brand-scoped codec used to parse values read from the database.

MySqlCustomColumnBuilder<{ columnType: "MySqlCustomColumn"; data: Id<Brand> | null; dataType: "custom"; driverParam: string | null; enumValues: undefined; name: ""; }>

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