Skip to main content

Function: defaultValueExpr()

function defaultValueExpr(type, value): string;

Defined in: packages/ir/src/helpers.ts:307

A literal default value (field.default.value) as a source-code expression for the given field type. A bigint scalar's default is always a numeric string on the IR (Prisma's DMMF encodes BigInt that way, and JsonValue has no bigint member) — this renders it as an unquoted bigint literal ("0" -> 0n) instead of re-quoting it via JSON.stringify. Every other type renders via plain JSON.stringify.

Parameters​

ParameterType
typeFieldType
valueJsonValue

Returns​

string