GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TML-3607: Client generators are written @onCreate and @onUpdate, and @default means a database default by wmadden-electric · Pull Request #30780 · prisma/orm

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

A value the client generates is now written as an attribute that names the phase, and @default means a database default only:

model Event {
  id        String      @id @onCreate(uuid(7))
  code      VarChar(32) @onCreate(nanoid())
  createdAt DateTime    @default(now()) @onCreate(now())
  seenAt    Time(3)     @onUpdate(now())
}

Before, id and code were @default(uuid(7)) and @default(nanoid()), and an update-time value needed a field preset such as temporal.time(3, onUpdate: now). Now @default(uuid()) is refused with PSL_GENERATOR_IN_DEFAULT and a message that says to write @onCreate(uuid()). The TypeScript builder has the same two methods:

id: field.column(uuidColumn).id().onCreate(gen.uuid(7)),
seenAt: field.column(timeColumn(3)).onUpdate(gen.now()),

This is slice 1 of three for TML-3607, as ADR 275 decides. The project spec and the slice plan are in projects/remove-field-presets/.

What changed

A registry of generator functions. Each function name (now, uuid, cuid, ulid, nanoid, ksuid) maps a column's codec to the generator that writes a value that codec encodes. The family declares the functions. The targets and extensions bind them to their codecs. The control stack and both TypeScript builders assemble the registry from the composed packs. An attribute whose function has no binding for the column's codec is refused (PSL_GENERATOR_NOT_APPLICABLE). So @onCreate(now()) on a String column fails at emit, not at runtime.

  • now() resolves per codec. For example, instantNow for Timestamptz, timestampStringNow for TimestampString, and plainTimeNow with the column's precision for Time(3).
  • nanoid() writes 21 characters, or the size given. A size that does not fit a Char(n) or VarChar(n) column is refused. The size never comes from the column, so no existing contract changes.
  • ksuid() is a new function. The generator already existed.
  • Two components registering one generator id is a contribution error (CONTRACT.PACK_CONTRIBUTION_INVALID) that names both components.

@onCreate and @onUpdate in SQL and Mongo PSL. Each attribute has its own attribute spec, so the language server completes the functions a field accepts. A field with two @onCreate attributes is refused (PSL_DUPLICATE_ATTRIBUTE). So is a list field, or, on Mongo, an optional field. @default(now()) stays a database default, and a column may have both a database default and a client generator.

TypeScript. gen is built from the stack's packs, so each facade's gen lists exactly that stack's functions. gen.uuid(5) and, on Mongo, gen.uuid() fail type checking. .onCreate() and .onUpdate() match the PSL rules. A refusal reaches the CLI under its own code, CONTRACT.DEFAULT_INVALID with a reason, not as a generic CONTRACT.SOURCE_LOAD_FAILED.

The Prisma 7 and Prisma 6 readers resolve @updatedAt and Prisma 7's client functions through the registry. They build the same contracts as before. A nanoid that cannot fit its column is now refused with PSL.PRISMA7_GENERATOR_REFUSED, since Postgres would reject the insert.

contract print writes generated columns as @onCreate(...) and @onUpdate(...). It checks that each call resolves back to the stored generator. The preset print forms are removed.

Field presets still work in this slice. Slice 2 expands type aliases into each column. Slice 3 removes presets.

Upgrading

  • Apps. upgrade-instructions/pending/default-generators-to-on-create/app/ has a script that rewrites @default(<client function>()) to @onCreate(...) in files that start with // use prisma-8. It keeps the call text exactly, and leaves comments, string literals and Prisma 7 schemas alone. The rewrite changes no contract hash. The 224 uses in this repository's 88 schemas were rewritten with it, and fixtures:check shows no contract change.
  • Extension authors. A default function no longer produces a client generator. Bind a generator function instead. The SQL family now registers the identifier generators, so an extension or SQL target that registers uuidv4, uuidv7, cuid2, ulid, nanoid or ksuid itself must stop. builtinGeneratorRegistryMetadata is removed. See the extension fragment.

How it was checked

  • Tests first for each behaviour. Postgres and Mongo twins of the preset fixtures, written with attributes, emit identical storage and execution hashes. A print round trip covers the example above.
  • Four rounds of design and code review, and every finding fixed. Reviews are under projects/remove-field-presets/slices/01-generator-attributes/reviews/ (local only).
  • Manual QA with the real CLI and an in-process Postgres and Mongo: projects/remove-field-presets/manual-qa-reports/2026-10-19-slice-1.md. It found two older issues, filed as TML-3642 and TML-3643.

Alternatives considered

  • Check compatibility by data type and cast the value. Not chosen. Two codecs of one data type expect different in-memory values, so a data type check accepts generators the codec cannot encode (ADR 275).
  • Accept @default(uuid()) with a warning until slice 3. Not chosen. Every use in the repository could move in this slice, and the upgrade script moves users' schemas without changing their contracts.
  • Take nanoid's size from the column's length. Not chosen. It would change the IDs and hashes of existing Char columns on upgrade, and diverge from Prisma 7.
  • A fixed gen list in the framework. Not chosen. An extension's functions would have no TypeScript form, and Mongo would offer functions it cannot resolve.

Closes nothing yet: TML-3607 closes with slice 3.

Agent: pele-26

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
wmadden-electric added 30 commits October 19, 2026 17:27
@wmadden-electric
TML-3607: Project spec, plan and slice 1 spec for removing field presets
ae93ce6
The project spec groups the requirements of ADR 275 by area. The plan splits the work into three PRs: generator attributes, alias expansion, and preset removal. The slice 1 spec gives the code changes, decisions, tests and docs for the generator attributes.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Add the generator function registry and its family and targ…
63595db
…et bindings

The framework holds the registry shape and assembly. The SQL family declares now, uuid, cuid, ulid, nanoid and ksuid and binds the identifier functions to its char, varchar and text codecs. Postgres binds now to its date and time codecs and the identifier functions to its text-like and uuid codecs; SQLite and Mongo bind their own. The control stack assembles the registry and checks every binding against the generators the stack registers.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Add @onCreate and @onUpdate to SQL and Mongo PSL
6e37ef9
Both families register the two attributes in their attribute-spec namespaces. Each offers only the generator functions bound to the field codec, and the interpreters resolve the call through the stack registry with the column type parameters. The registry reaches the binder, the interpreters and the language server through the contract source context. A call that the codec does not bind, an unknown function, a list field, and a phase a field preset already sets are refused; Mongo also refuses an optional field. The @updatedat hints name the attribute form.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: contract print writes generated columns as @onCreate and @o…
f6442f7
…nUpdate

Print writes each generator as the call of the generator function the stack binds to the column codec, after any @default, and checks that the call resolves back to the stored generator. It now writes on-update generators and a generator beside a database default, which it refused before. The field preset print search, the default function printers and their refusals are removed, since print was their only user. The slugid parity pack contributes a generator function.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: The Prisma 7 and Prisma 6 readers resolve generators throug…
18ac609
…h the registry

The Prisma 7 reader resolves @updatedat as now() for both phases and the client functions in @default as onCreate through the generator function registry, and keeps database functions on the default function registry. The Prisma 6 Mongo reader resolves @updatedat and @default(now()) the same way. Prisma7TargetBinding.updatedAtGenerator and Prisma6TargetBinding.timestampGeneratorId are removed. The contracts both readers build do not change.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Test only the component ids the mutation default assembly k…
557a63c
…eeps

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Add .onCreate and .onUpdate with gen to the SQL and Mongo T…
0037bbc
…ypeScript builders

A field builder takes a call from gen, such as gen.uuid(7) or gen.now(), and the call is resolved by the column codec and type params through the generator functions of the family, target and extension packs when the contract is built. .onCreate makes the field optional on create; .onUpdate alone does not. Setting a phase twice, or a phase a preset already sets, throws CONTRACT.DEFAULT_INVALID. The SQL, Mongo and facade contract-builder entries export gen.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Upgrade instructions for moving client generators to @onCreate
47cdadf


The app fragment ships a script that rewrites @default(uuid()), @default(cuid(2)), @default(ulid()) and @default(nanoid()) to @onCreate in the Prisma 8 schema files it is given, and leaves a Prisma 7 schema unchanged. The extension fragment says how a default function that generated a value becomes a generator function. The pending contract-print-generated-values fragment, whose printArguments guidance this change removes before release, now points to the new fragment.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Prove the attribute forms of the temporal presets emit the …
209d67d
…same hashes

Each Postgres date and time preset field and the Mongo temporal preset fields get a twin written with type constructors and @onCreate(now()) @onUpdate(now()). The twins emit the same storage and execution hashes as the presets they replace.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: @default sets a database default only
0e7db92
The default function registries keep autoincrement and now. A default function can no longer lower to a client generator, and @default(uuid()), @default(cuid(2)), @default(ulid()) and @default(nanoid()) are refused with PSL_GENERATOR_IN_DEFAULT, whose message names the @onCreate form. applicableCodecIds and buildPhases are removed from generator descriptors, since bindings declare the codecs a generator fills.

Every Prisma 8 schema, inline test schema and doc example that wrote a client function in @default now writes @onCreate. The emitted contracts do not change.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Document generator attributes and accept ADR 275
d9b24a9
ADR 275 is accepted, with its nanoid rule limited to fixed-length columns and the break for extension default functions recorded. ADRs 158, 169, 231, 249 and 269 are amended. The error reference lists PSL_GENERATOR_IN_DEFAULT, PSL_UNKNOWN_GENERATOR_FUNCTION, PSL_GENERATOR_NOT_APPLICABLE and PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED, and the TypeScript generator reasons of CONTRACT.DEFAULT_INVALID. The subsystem docs, package READMEs, the contract skill reference and the PSL scorecard describe @onCreate, @onUpdate and gen.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Name the input of a generator function a field, and test ge…
8a8b9f9
…n against the family signatures

The framework is family-blind, so a generator resolves for a GeneratorFunctionField, a column in SQL and a document field in Mongo, instead of a column. The framework vocabulary threshold drops to the new count. A test checks that every gen helper passes only the argument keys of its SQL family signature and resolves on a column the function binds.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Record the planner golden of the attribute twin of the now …
fb224a3
…fixture

Its recording differs from the now fixture only in the contract path.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Build gen from the composed packs and check generators on e…
79f2b5b
…very stack

The generator function vocabulary has one home in @internal/framework-components/components, with one call type, GeneratorFunctionCall, and BindingResolution for a binding result. gen is built from the composed family, target and extension packs like the type helpers, so each stack holds exactly its functions; the closed framework list and its parity test are gone. The generator descriptors move from the adapters to the target pack refs, so every stack, both TypeScript builders included, checks that a binding produces a registered generator, and resolve refuses a generator id a binding does not declare. ContractSourceContext.generatorFunctions is required.

nanoid never takes its size from the column; a size that does not fit a Char or VarChar column is refused. The SQL builder refuses a generator on a list field, PSL refuses a repeated @onCreate or @onUpdate, and Mongo refuses an optional generated field with PSL_OPTIONAL_EXECUTION_DEFAULT_UNSUPPORTED. The print logic that turns generators into calls moves to the SQL family. Tests cover the real Postgres bindings, the language server config path, parity through the facades and an extension, and a print round trip of the slice example.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Rewrite @default generators only in files with the Prisma 8…
6026433
… header

The upgrade script now rewrites a file only when its first line is // use prisma-8 or the older // use prisma-next, and prints a line for each file it skips. A Prisma 7 schema split across files keeps @default(uuid()) in its model-only files. The tests add a model-only Prisma 7 file, a file with the older header and a commented call.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Document the composed gen, the nanoid size rule and the new…
45a5352
… refusals

ADR 275, the project and slice specs and the READMEs say that nanoid never reads its size from the column and that gen is built from the composed packs. The error reference adds PSL_OPTIONAL_EXECUTION_DEFAULT_UNSUPPORTED, PSL_DUPLICATE_ATTRIBUTE and the generator-on-list reason. The extension upgrade guide imports from the components entry and asks for generator descriptors on the pack ref. The plan adds the preset names that slice 3 renames, and deferred.md records that default functions still live on the adapters.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Add the family generator call writer the tip imports
12aad90
generator-calls.ts was left out of the previous commit by a file filter, so the tip did not build.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Type the facade gen from the packs of each facade
2d8034e
The Mongo target pack ref named its fields without generatorFunctions, so the Mongo gen was typed {} and gen.now() did not type-check. Each facade now takes gen from the same packs as its defineContract: Postgres from the one composed helpers call that gives field, SQLite and Mongo typed by their builder helper types. Type tests check the exact functions of each facade gen and refuse a wrong argument. The Mongo target registers timestampNow as the SQL targets do, without a /control import.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: The SQL family registers the identifier generators it binds
f90f4dd
The component that contributes a binding registers its generator ids. The SQL family registers uuidv4, uuidv7, cuid2, ulid, ksuid and nanoid, so a SQL target that binds them through idGeneratorFunctionBindings registers none. Postgres and SQLite register only their now generators and no longer depend on @internal/ids. GeneratorPhase is defined once, and the family call text is named PhaseCallText. The planner manifest records the time parity contract.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Refuse named generator parameters and share the signature m…
ea6d4ab
…arkers

gen passes arguments by position, so assembly refuses a generator function signature with named parameters. The argument output marker gen reads is defined in the components entry, and psl-parser ArgTypeOutput extends it. ExtensionPackValues and GeneratorPhase have one definition in the components entry, and the ComponentMetadata doc says pack refs carry generator descriptors.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Give the Prisma 7 reader its own diagnostic for a generator…
90811aa
… the column refuses

@db.Char(10) @default(nanoid()) is refused with PSL.PRISMA7_GENERATOR_REFUSED, since Postgres refuses such an insert. It was PSL.PRISMA7_UNKNOWN_DEFAULT. The README lists it as the one shape main read that the reader now refuses. The test support drops a dead fallback.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Read the Prisma 8 directive as contract emit does in the up…
8914485
…grade script

The script uses the directive rule of isPrismaNextSchema over the whole text, so a blank line or a byte order mark before the directive, //use prisma-8 and text after it are all read as Prisma 8. The language server integration test passes clientSupportsSnippets.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Document the family generator ids and the Prisma 7 refusal
443b7fa
The slice spec says the SQL family registers the identifier generators and that named parameters are refused, D3 and D11 record the Prisma 7 nanoid refusal, and the error reference adds PSL.PRISMA7_GENERATOR_REFUSED.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Add the slice 1 manual QA script and its first report
7d295a1
The script checks generator attributes through the real CLI on Postgres, Prisma 7, the TypeScript builder and MongoDB, plus the upgrade script. Every step passed; the report lists six minor observations.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Refuse a generator two components register, in every stack
92caf9c
assembleControlMutationDefaults and assembleGeneratorFunctions share one check, so contract emit and the TypeScript builders both refuse a repeated generator id with CONTRACT.PACK_CONTRIBUTION_INVALID, naming the id and both components. It was an InternalError on the control stack and accepted by the builders. The extension guide tells a target, adapter or extension that registers the identifier generators the SQL family now registers to stop, with a detection for it. A test pins the family ids to builtinGeneratorIds, and the unused builtinGeneratorRegistryMetadata is removed. psl-parser builds its optional marks on the shared SignatureOptionalArgument. deferred.md records the five empty default function registries.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Write the refused Prisma 7 call as the schema writes it
9d54540
PSL.PRISMA7_GENERATOR_REFUSED quotes the call from the source, so cuid() stays cuid() and spaces are kept. The README says main read the Char(n) form and refused the VarChar(n) form under another code. A VarChar case is tested.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Report a structured error a contract source throws under it…
d90c273
…s own code

A TypeScript builder refusal such as CONTRACT.DEFAULT_INVALID reached the CLI wrapped in CONTRACT.SOURCE_LOAD_FAILED with a generic hint, and --json lost its code and reason. It is now reported as it is, as errorFromCaught does for other commands.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Keep comments and call text when rewriting @default generators
829bd38
The upgrade script no longer rewrites or counts @default calls in // comments, keeps the call exactly as written and changes only the attribute name, and says "1 @default call". A test checks that it treats a file as Prisma 8 exactly when isPrismaNextSchema does.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
Merge remote-tracking branch 'origin/main' into tml-3607-generator-at…
fc47765
…tributes
@wmadden-electric
Lower the framework vocabulary threshold to 237
bcf5d07
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added 3 commits October 19, 2026 23:32
@wmadden-electric
TML-3607: Leave string literals unchanged when rewriting @default gen…
ae368e4
…erators

The upgrade script rewrites calls only in code, outside string literals and comments, so @default("x @default(uuid()) y") keeps its value. The extension detection also matches double-quoted ids, and its summary lists the repeated-registration refusal.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Keep a thrown source error in ControlClient.emit and say so…
eb34897
… in the docs

ControlClient.emit keeps the code and meta of a structured error the source throws, with its message as summary and its why. The structured-error mapping is shared with errorFromCaught, without an unused why callback. The source load doc comment, the contract print throws and the CLI README say a structured source error is reported under its own code.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
TML-3607: Name the generator registration assembly for what it does
a73b436
registeredGeneratorDescriptors becomes assembleGeneratorRegistrations, with a GeneratorRegistration entry type. The error reference lists the repeated-registration and named-parameter refusals, the spec says builtinGeneratorRegistryMetadata is removed, and deferred.md notes that the assembled generator descriptor list has no production reader.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner October 19, 2026 21:36
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 383 files, which is 83 over the limit of 300.

To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration
  • Configuration used: Repository: prisma/orm/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e351c62f-a081-4695-adf3-627744d5e493
📥 Commits

Reviewing files that changed from the base of the PR and between ab6da23 and 42d41d3.

⛔ Files ignored due to path filters: 11
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/remove-field-presets/deferred.md is excluded by !projects/**
  • projects/remove-field-presets/manual-qa-reports/2026-10-19-slice-1.md is excluded by !projects/**
  • projects/remove-field-presets/manual-qa.md is excluded by !projects/**
  • projects/remove-field-presets/plan.md is excluded by !projects/**
  • projects/remove-field-presets/slices/01-generator-attributes/spec.md is excluded by !projects/**
  • projects/remove-field-presets/spec.md is excluded by !projects/**
  • test/integration/test/mongo/temporal-presets/_fixture-attributes/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/mongo/temporal-presets/_fixture-attributes/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-attributes/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-attributes/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing: 383
  • docs/architecture docs/adrs/ADR 158 - Execution mutation defaults.md
  • docs/architecture docs/adrs/ADR 169 - Declared applicability for mutation default generators.md
  • docs/architecture docs/adrs/ADR 226 - Cross-contract foreign-key references.md
  • docs/architecture docs/adrs/ADR 231 - Declarative attribute specifications.md
  • docs/architecture docs/adrs/ADR 244 - Check constraints are opaque wire-named expressions.md
  • docs/architecture docs/adrs/ADR 249 - Central attribute-spec registry.md
  • docs/architecture docs/adrs/ADR 269 - PSL mixins.md
  • docs/architecture docs/adrs/ADR 275 - Client generators are field attributes, and a type alias is expanded into each column.md
  • docs/architecture docs/subsystems/10. MongoDB Family.md
  • docs/architecture docs/subsystems/6. Ecosystem Extensions & Packs.md
  • docs/reference/error-reference.md
  • examples/prisma-8-cloudflare-worker/src/prisma/contract.prisma
  • examples/prisma-8-demo/fixtures/converging-branches/contract.prisma
  • examples/prisma-8-demo/fixtures/diamond/contract.prisma
  • examples/prisma-8-demo/fixtures/long-spine/contract.prisma
  • examples/prisma-8-demo/fixtures/multi-branch/contract.prisma
  • examples/prisma-8-demo/fixtures/showcase/contract.prisma
  • examples/prisma-8-demo/fixtures/skip-rollback/contract.prisma
  • examples/prisma-8-demo/fixtures/wide-fan/contract.prisma
  • examples/prisma-8-demo/migrations/app/20260422T0720_initial/contract.prisma
  • examples/prisma-8-demo/migrations/app/20260810T1108_add_post_engagement_counters/contract.prisma
  • examples/prisma-8-demo/migrations/app/20260917T0818_add_post_expires_at/contract.prisma
  • examples/prisma-8-demo/migrations/app/20260922T1218_add_post_title_search/contract.prisma
  • examples/prisma-8-demo/migrations/app/20261009T1354_add_post_body_search/contract.prisma
  • examples/prisma-8-demo/src/prisma/contract.prisma
  • examples/prisma-8-demo/test/repositories.integration.test.ts
  • examples/prisma-8-postgis-demo/README.md
  • examples/prisma-8-postgis-demo/migrations/app/20260512T1309_migration/contract.prisma
  • examples/prisma-8-postgis-demo/src/prisma/contract.prisma
  • examples/react-router-demo/src/prisma/contract.prisma
  • examples/supabase/src/contract.prisma
  • packages/1-framework/1-core/config/src/contract-source-types.ts
  • packages/1-framework/1-core/framework-components/src/control/control-stack.ts
  • packages/1-framework/1-core/framework-components/src/exports/authoring.ts
  • packages/1-framework/1-core/framework-components/src/exports/components.ts
  • packages/1-framework/1-core/framework-components/src/exports/control.ts
  • packages/1-framework/1-core/framework-components/src/shared/field-preset-print-form.ts
  • packages/1-framework/1-core/framework-components/src/shared/framework-components.ts
  • packages/1-framework/1-core/framework-components/src/shared/generator-functions.ts
  • packages/1-framework/1-core/framework-components/src/shared/generator-helpers.ts
  • packages/1-framework/1-core/framework-components/src/shared/mutation-default-types.ts
  • packages/1-framework/1-core/framework-components/src/shared/temporal-presets.ts
  • packages/1-framework/1-core/framework-components/test/control-mutation-defaults-assembly.test.ts
  • packages/1-framework/1-core/framework-components/test/control-stack.generator-functions.test.ts
  • packages/1-framework/1-core/framework-components/test/control-stack.test.ts
  • packages/1-framework/1-core/framework-components/test/default-function-lowering.types.test-d.ts
  • packages/1-framework/1-core/framework-components/test/default-function-printers.test.ts
  • packages/1-framework/1-core/framework-components/test/field-preset-print-forms.test.ts
  • packages/1-framework/1-core/framework-components/test/generator-functions.test.ts
  • packages/1-framework/1-core/framework-components/test/generator-helpers.test-d.ts
  • packages/1-framework/1-core/framework-components/test/generator-helpers.test.ts
  • packages/1-framework/1-core/framework-components/test/temporal-presets.test.ts
  • packages/1-framework/2-authoring/ids/src/index.ts
  • packages/1-framework/2-authoring/ids/test/ids.test.ts
  • packages/1-framework/2-authoring/psl-parser/README.md
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/generator-attribute.ts
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/spec-context.ts
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/types.ts
  • packages/1-framework/2-authoring/psl-parser/src/bind-psl-schema.ts
  • packages/1-framework/2-authoring/psl-parser/src/binder.ts
  • packages/1-framework/2-authoring/psl-parser/src/exports/index.ts
  • packages/1-framework/2-authoring/psl-parser/test/binder-contributed-types.test.ts
  • packages/1-framework/2-authoring/psl-parser/test/support.ts
  • packages/1-framework/2-authoring/psl-parser/test/symbol-table.test.ts
  • packages/1-framework/2-authoring/psl-printer/test/declarative-policy-select.round-trip.test.ts
  • packages/1-framework/3-tooling/cli/README.md
  • packages/1-framework/3-tooling/cli/src/control-api/client.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/caught-errors.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/contract-print.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/load-contract-source.ts
  • packages/1-framework/3-tooling/cli/src/control-api/types.ts
  • packages/1-framework/3-tooling/cli/test/control-api/client.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/load-contract-source.test.ts
  • packages/1-framework/3-tooling/language-server/src/attribute-spec-resolution.ts
  • packages/1-framework/3-tooling/language-server/src/config-resolution.ts
  • packages/1-framework/3-tooling/language-server/src/lsp-control-stack.ts
  • packages/1-framework/3-tooling/language-server/test/attribute-spec-consumability.test.ts
  • packages/1-framework/3-tooling/language-server/test/block-spec-context.test.ts
  • packages/1-framework/3-tooling/language-server/test/completion-field-references.test.ts
  • packages/1-framework/3-tooling/language-server/test/completion-provider.test.ts
  • packages/1-framework/3-tooling/language-server/test/completion-symbols.test.ts
  • packages/1-framework/3-tooling/language-server/test/completion-values.test.ts
  • packages/1-framework/3-tooling/language-server/test/config-resolution.test.ts
  • packages/1-framework/3-tooling/language-server/test/generator-attributes.test.ts
  • packages/1-framework/3-tooling/language-server/test/helpers/binder.ts
  • packages/1-framework/3-tooling/language-server/test/helpers/block-value-completion.ts
  • packages/1-framework/3-tooling/language-server/test/helpers/reference-fixtures.ts
  • packages/1-framework/3-tooling/language-server/test/project-artifacts.test.ts
  • packages/1-framework/3-tooling/language-server/test/project-registry.test.ts
  • packages/1-framework/3-tooling/language-server/test/project.test.ts
  • packages/1-framework/3-tooling/language-server/test/server.membership-races.test.ts
  • packages/1-framework/3-tooling/language-server/test/server.test.ts
  • packages/1-framework/3-tooling/language-server/test/signature-help-block-values.test.ts
  • packages/1-framework/3-tooling/language-server/test/signature-help-values.test.ts
  • packages/1-framework/3-tooling/language-server/test/signature-help.test.ts
  • packages/2-mongo-family/2-authoring/contract-prisma6/src/interpreter.ts
  • packages/2-mongo-family/2-authoring/contract-prisma6/src/provider.ts
  • packages/2-mongo-family/2-authoring/contract-prisma6/src/target-binding.ts
  • packages/2-mongo-family/2-authoring/contract-prisma6/test/support.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/mongo-attribute-specs.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/provider.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/block-spec-context.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/create-binder.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter-test-helpers.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.attribute-specs.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.generator-attributes.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/mongo-attribute-specs.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/provider.interpret.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/README.md
  • packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/exports/contract-builder.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.generator-calls.test.ts
  • packages/2-sql/2-authoring/contract-prisma7/README.md
  • packages/2-sql/2-authoring/contract-prisma7/src/defaults.ts
  • packages/2-sql/2-authoring/contract-prisma7/src/diagnostics.ts
  • packages/2-sql/2-authoring/contract-prisma7/src/interpreter.ts
  • packages/2-sql/2-authoring/contract-prisma7/src/provider.ts
  • packages/2-sql/2-authoring/contract-prisma7/src/target-binding.ts
  • packages/2-sql/2-authoring/contract-prisma7/test/defaults.test.ts
  • packages/2-sql/2-authoring/contract-prisma7/test/support.ts
  • packages/2-sql/2-authoring/contract-prisma7/test/updated-at-generators.test.ts
  • packages/2-sql/2-authoring/contract-psl/README.md
  • packages/2-sql/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-sql/2-authoring/contract-psl/src/provider.ts
  • packages/2-sql/2-authoring/contract-psl/src/psl-column-resolution.ts
  • packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts
  • packages/2-sql/2-authoring/contract-psl/src/sql-attribute-specs.ts
  • packages/2-sql/2-authoring/contract-psl/src/test.ts
  • packages/2-sql/2-authoring/contract-psl/test/composed-mutation-defaults.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/create-binder.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/default-function-registry.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/fixture-generator-functions.ts
  • packages/2-sql/2-authoring/contract-psl/test/fixtures.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter-defaults-support.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.functions.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.generated-values.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.generator-storage.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.list-columns.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.preset-misuse.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.presets.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.tagged-literal.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.enum.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.generator-attributes.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.nullable-list-shapes.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.unknown-attributes.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.interpret.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/semantic-diagnostics.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/sql-attribute-specs.test.ts
  • packages/2-sql/2-authoring/contract-ts/README.md
  • packages/2-sql/2-authoring/contract-ts/src/composed-authoring-helpers.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-lowering.ts
  • packages/2-sql/2-authoring/contract-ts/test/config-types.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-dsl.generator-calls.test-d.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-dsl.generator-calls.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/helpers/generator-function-packs.ts
  • packages/2-sql/2-authoring/contract-ts/test/specifier-strip.authoring.test.ts
  • packages/2-sql/9-family/package.json
  • packages/2-sql/9-family/src/core/control-descriptor.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/2-sql/9-family/src/core/control-target-descriptor.ts
  • packages/2-sql/9-family/src/core/generator-functions.ts
  • packages/2-sql/9-family/src/core/psl-build/generated-values.ts
  • packages/2-sql/9-family/src/core/psl-build/generator-calls.ts
  • packages/2-sql/9-family/src/exports/pack.ts
  • packages/2-sql/9-family/src/exports/psl-build.ts
  • packages/2-sql/9-family/test/authoring-entity-types.enum-block-attribute.test.ts
  • packages/2-sql/9-family/test/control-instance.build-psl-contract.test.ts
  • packages/2-sql/9-family/test/generator-functions.test.ts
  • packages/2-sql/9-family/test/psl-build/generated-values.test.ts
  • packages/2-sql/9-family/test/psl-build/generator-calls.test.ts
  • packages/3-extensions/mongo/src/contract/gen.ts
  • packages/3-extensions/mongo/src/exports/contract-builder.ts
  • packages/3-extensions/mongo/test/config/define-config.psl.test.ts
  • packages/3-extensions/mongo/test/gen.test-d.ts
  • packages/3-extensions/postgis/README.md
  • packages/3-extensions/postgres/src/contract/field.ts
  • packages/3-extensions/postgres/src/exports/contract-builder.ts
  • packages/3-extensions/postgres/test/config/define-config.glob-e2e.test.ts
  • packages/3-extensions/postgres/test/contract-builder/full-text-index.test.ts
  • packages/3-extensions/postgres/test/gen.test-d.ts
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/sqlite/src/contract/gen.ts
  • packages/3-extensions/sqlite/src/exports/contract-builder.ts
  • packages/3-extensions/sqlite/test/gen.test-d.ts
  • packages/3-extensions/supabase/test/fixtures/example-app/contract.prisma
  • packages/3-extensions/supabase/test/fixtures/no-policy/contract.prisma
  • packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.prisma
  • packages/3-mongo-target/1-mongo-target/src/core/descriptor-meta.ts
  • packages/3-mongo-target/1-mongo-target/src/core/prisma6-binding.ts
  • packages/3-mongo-target/1-mongo-target/src/exports/pack.ts
  • packages/3-mongo-target/1-mongo-target/test/generator-functions.test.ts
  • packages/3-targets/3-targets/postgres/src/core/date-time-now-generators.ts
  • packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts
  • packages/3-targets/3-targets/postgres/src/core/generator-functions.ts
  • packages/3-targets/3-targets/postgres/src/core/now-generators.ts
  • packages/3-targets/3-targets/postgres/src/core/prisma7-binding.ts
  • packages/3-targets/3-targets/postgres/src/core/psl-print/column-types.ts
  • packages/3-targets/3-targets/postgres/src/core/psl-print/generated-values.ts
  • packages/3-targets/3-targets/postgres/src/core/psl-print/refusals.ts
  • packages/3-targets/3-targets/postgres/src/core/psl-print/scalar-fields.ts
  • packages/3-targets/3-targets/postgres/src/core/type-constructors.ts
  • packages/3-targets/3-targets/postgres/test/authoring-field-presets.test.ts
  • packages/3-targets/3-targets/postgres/test/generator-functions.test.ts
  • packages/3-targets/3-targets/postgres/test/index-types.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/full-text-index-planning.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-full-text-index.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-infer/fixtures.ts
  • packages/3-targets/3-targets/postgres/test/psl-infer/infer-parse-emit.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-infer/infer-psl-contract.enum-adoption.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-infer/inferred-psl.round-trip.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-infer/inferred-psl/inferred-psl.top-level-blocks.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-native-enum-authoring.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-pg-enum-column.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-policy-authoring.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-policy-cross-namespace.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-policy-map-authoring.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-policy-mixin.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-policy-predicates.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-print/build-context.ts
  • packages/3-targets/3-targets/postgres/test/psl-print/generated-values.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-print/refusals-fields.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-print/refusals-named-types.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-rls-authoring.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-rls-operations.test.ts
  • packages/3-targets/3-targets/postgres/test/psl-role-authoring.test.ts
  • packages/3-targets/3-targets/postgres/test/sql-expression-places.test.ts
  • packages/3-targets/3-targets/sqlite/src/core/descriptor-meta.ts
  • packages/3-targets/3-targets/sqlite/src/core/generator-functions.ts
  • packages/3-targets/3-targets/sqlite/src/core/type-constructors.ts
  • packages/3-targets/3-targets/sqlite/test/generator-functions.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/control-mutation-defaults.ts
  • packages/3-targets/6-adapters/postgres/src/exports/control.ts
  • packages/3-targets/6-adapters/postgres/test/control-mutation-defaults.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/native-enum-add-value.real-postgres.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/native-enum-lifecycle-e2e.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/rls-lifecycle-e2e.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/rls-migration-plan.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/rls-walking-skeleton-psl.integration.test.ts
  • packages/3-targets/6-adapters/sqlite/src/core/control-mutation-defaults.ts
  • packages/3-targets/6-adapters/sqlite/src/exports/control.ts
  • scorecard/03-psl-schema-language.md
  • scripts/lint-framework-vocabulary.config.json
  • scripts/lint-legacy-name.mjs
  • skills/prisma-8/references/contract.md
  • skills/prisma-8/references/supabase.md
  • test/integration/package.json
  • test/integration/test/authoring/attribute-specs.lsp-consumability.test.ts
  • test/integration/test/authoring/cli.emit-parity-fixtures.test.ts
  • test/integration/test/authoring/data-type-value.test.ts
  • test/integration/test/authoring/diagnostics/invalid-default-arguments/schema.prisma
  • test/integration/test/authoring/diagnostics/removed-dbgenerated/expected-diagnostics.json
  • test/integration/test/authoring/diagnostics/unsupported-default-cuid/schema.prisma
  • test/integration/test/authoring/lsp-emit-parity.integration.test.ts
  • test/integration/test/authoring/parity/default-cuid-2/schema.prisma
  • test/integration/test/authoring/parity/default-nanoid-16/contract.ts
  • test/integration/test/authoring/parity/default-nanoid-16/schema.prisma
  • test/integration/test/authoring/parity/default-nanoid/schema.prisma
  • test/integration/test/authoring/parity/default-pack-slugid/contract.ts
  • test/integration/test/authoring/parity/default-pack-slugid/packs.ts
  • test/integration/test/authoring/parity/default-pack-slugid/schema.prisma
  • test/integration/test/authoring/parity/default-ulid/schema.prisma
  • test/integration/test/authoring/parity/default-uuid-v4/schema.prisma
  • test/integration/test/authoring/parity/default-uuid-v7/contract.ts
  • test/integration/test/authoring/parity/default-uuid-v7/schema.prisma
  • test/integration/test/authoring/parity/generator-on-update-time/contract.ts
  • test/integration/test/authoring/parity/generator-on-update-time/expected.contract.json
  • test/integration/test/authoring/parity/generator-on-update-time/packs.ts
  • test/integration/test/authoring/parity/generator-on-update-time/schema.prisma
  • test/integration/test/authoring/psl-index-type-options.integration.test.ts
  • test/integration/test/authoring/psl-types-blocks.integration.test.ts
  • test/integration/test/authoring/psl.pgvector-data-type-default.test.ts
  • test/integration/test/authoring/psl.pgvector-dbinit.test.ts
  • test/integration/test/authoring/psl.sqlite-written-values.test.ts
  • test/integration/test/authoring/side-by-side-contracts.test.ts
  • test/integration/test/cli.emit-command.test.ts
  • test/integration/test/cli.emit-contract.test.ts
  • test/integration/test/date-time-defaults/sqlite-authoring.ts
  • test/integration/test/mongo/interpreter.enum.test.ts
  • test/integration/test/mongo/migration-psl-authoring.test.ts
  • test/integration/test/mongo/target-runner/runner-polymorphism.test.ts
  • test/integration/test/mongo/temporal-presets/_fixture-attributes/contract.prisma
  • test/integration/test/mongo/temporal-presets/_fixture-attributes/contract.ts
  • test/integration/test/mongo/temporal-presets/_fixture-attributes/prisma.config.ts
  • test/integration/test/mongo/temporal-presets/generator-attributes-parity.test.ts
  • test/integration/test/mongo/temporal-presets/temporal-presets.test.ts
  • test/integration/test/number-defaults/psl-number-defaults.integration.test.ts
  • test/integration/test/ports/prisma/functional/blog-update/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/decimal-list/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/decimal-precision/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/driver-adapters-team-orm-687-bytes/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/enum-array/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/extended-where/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-12378/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-12572/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-15044/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-23902/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/issues-29331-query-plan-cache-bloat.test.ts
  • test/integration/test/ports/prisma/functional/issues-4004/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-count/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-createMany/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-createManyAndReturn/methods-createManyAndReturn.test.ts
  • test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/methods-updateManyAndReturn.test.ts
  • test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/contract.prisma
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/contract.prisma
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/contract.prisma
  • test/integration/test/ports/prisma/functional/multiple-types/_fixture/contract.prisma
  • test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/contract.prisma
  • test/integration/test/prisma7-source/implicit-many-to-many-names.integration.test.ts
  • test/integration/test/prisma7-source/interpreter-fixtures.integration.test.ts
  • test/integration/test/prisma7-source/relations.integration.test.ts
  • test/integration/test/prisma7-source/supported.integration.test.ts
  • test/integration/test/psl-print/generated-values-roundtrip.integration.test.ts
  • test/integration/test/psl-print/print-and-read-back.ts
  • test/integration/test/scalar-lists/psl-list-authoring.ts
  • test/integration/test/sql-orm-client/collection-mutation-defaults-nullable.test.ts
  • test/integration/test/temporal-defaults/_fixture-attributes/contract.prisma
  • test/integration/test/temporal-defaults/_fixture-attributes/prisma.config.ts
  • test/integration/test/temporal-defaults/generator-attributes-parity.test.ts
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/default-generators-to-on-create.test.ts
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/blank-line-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/bom-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/no-space-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/older-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/prisma7-models.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/prisma7.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/schema.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/trailing-text-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/after/unchanged.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/blank-line-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/bom-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/no-space-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/older-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/prisma7-models.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/prisma7.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/schema.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/trailing-text-header.prisma
  • test/integration/test/upgrade-instructions/default-generators-to-on-create/fixtures/before/unchanged.prisma
  • test/integration/test/value-objects/value-object-defaults.integration.test.ts
  • test/integration/test/value-objects/value-objects.integration.test.ts
  • upgrade-instructions/pending/contract-print-generated-values/extension/instructions.md
  • upgrade-instructions/pending/default-generators-to-on-create/app/instructions.md
  • upgrade-instructions/pending/default-generators-to-on-create/app/scripts/rewrite-default-generators.mjs
  • upgrade-instructions/pending/default-generators-to-on-create/extension/instructions.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30780

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30780

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30780

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30780

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30780

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30780

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30780

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30780

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30780

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30780

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30780

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30780

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30780

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30780

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30780

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30780

commit: 42d41d3

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 256.91 KB (+1.37% 🔺)
postgres / emit 227.15 KB (+1.21% 🔺)
mongo / no-emit 208.07 KB (+1.04% 🔺)
mongo / emit 179.98 KB (0%)
cf-worker / no-emit 319.1 KB (+1.21% 🔺)
cf-worker / emit 285.91 KB (+1.03% 🔺)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wmadden-electric
TML-3607: The legacy-name check allows the upgrade script that reads …
c96ebfc
…the older schema header

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden
wmadden approved these changes Oct 20, 2026
View reviewed changes
@wmadden-electric
Merge branch 'main' of https://github.com/prisma/prisma into tml-3607…
dc34aa3
…-generator-attributes

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

# Conflicts:
#	docs/reference/error-reference.md
#	packages/2-sql/2-authoring/contract-ts/src/composed-authoring-helpers.ts
#	test/integration/test/planner-golden/manifest.json
@wmadden-electric
wmadden-electric added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
@wmadden-electric
Merge branch 'main' of https://github.com/prisma/prisma into tml-3607…
42d41d3
…-generator-attributes

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

# Conflicts:
#	docs/architecture docs/subsystems/10. MongoDB Family.md
#	packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts
#	packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
@wmadden-electric
wmadden-electric enabled auto-merge October 20, 2026 09:49
@wmadden-electric
wmadden-electric added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 8c4d9af Oct 20, 2026
24 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@wmadden-electric
wmadden-electric deleted the tml-3607-generator-attributes branch October 20, 2026 10:24
@wmadden-electric wmadden-electric mentioned this pull request Oct 21, 2026
TML-3607: Type aliases can set @onCreate and @onUpdate, and the contract stores the real column type instead of the alias name #30819
Merged
shahinsamiur pushed a commit to shahinsamiur/orm that referenced this pull request Oct 22, 2026
@wmadden-electric
TML-3607: Type aliases can set @onCreate and @onUpdate, and the contr…
b8421eb
…act stores the real column type instead of the alias name (prisma#30819)

## At a glance

After this PR, a Prisma 8 schema can define a reusable type once and
give it generated values:

```prisma
types {
  UpdatedAt = TimestampString(3) @onCreate(now()) @onUpdate(now())
}

model Post {
  id        String             @id @onCreate(uuid())
  createdAt temporal.CreatedAt
  updatedAt UpdatedAt
}
```

- `UpdatedAt` is a type alias, a name for `TimestampString(3)`. Any
field typed `UpdatedAt` gets that column type and the current time on
create and on every update.
- `temporal.CreatedAt` is a type alias that Postgres provides, so users
do not have to write their own.

Until now, an alias could not carry `@onCreate` or `@onUpdate`. The only
way to say "set this timestamp on every update" was a field preset such
as `temporal.timestampString(3, onCreate: now, onUpdate: now)`.

## The decision

**A type alias is a shorthand in the schema file, and the contract does
not store it.** When Prisma reads the schema, each field typed by an
alias gets the alias's type and attributes, exactly as if the user had
written them on the field. The contract then records the column's real
type. It no longer records the alias name.

So for this schema:

```prisma
types {
  Slug = VarChar(64)
}

model Post {
  slug Slug
}
```

The contract used to store the alias, with a column that only pointed at
it:

```json
"types": { "Slug": { "codecId": "sql/varchar@1", "typeParams": { "length": 64 } } },
"slug":  { "codecId": "sql/varchar@1", "typeRef": "Slug" }
```

It now stores the column alone:

```json
"slug": { "codecId": "sql/varchar@1", "typeParams": { "length": 64 } }
```

This is the second of three PRs for TML-3607, which carries out ADR 275.
The first, prisma#30780, made generated values attributes (`@onCreate(uuid())`
instead of `@default(uuid())`). This one makes aliases able to replace
field presets. The third will remove field presets.

## Why

The contract describes the database. An alias name exists only in the
schema file: renaming `Slug` to `ShortText` changes nothing in the
database, but it changed the contract's hash, so users had to sign their
database again. Nothing in the runtime reads the alias name.

Aliases were stored because PSL once had no way to write a type with its
parameters inline, such as `VarChar(64)`. It has that now, so the alias
can be resolved when the schema is read.

Once aliases can carry `@onCreate` and `@onUpdate`, they cover what
field presets were for: a reusable column type with generated values.
Unlike presets, any user can write one.

## What users get

**Aliases with generated values.** An alias may set `@default`,
`@onCreate` and `@onUpdate`. A field typed by the alias may add
attributes the alias does not set. Prisma refuses the following, each
with a message that says what to write instead:
- `@id` or `@unique` on an alias, because those describe a model's
field, not a type;
- a field that repeats an attribute its alias already sets;
- an alias defined as another alias.

**Ready-made timestamp aliases.** Postgres, SQLite and MongoDB each
provide `temporal.CreatedAt` (the time a row is created) and
`temporal.UpdatedAt` (the time it is created and every time it is
updated). Postgres also has `String` and `JsDate` variants, for the
other ways it can return a timestamp. Each one stores exactly what the
matching field preset stores today. So the third PR can remove the
presets without changing any user's contract. The editor completes these
names and shows their documentation.

**MongoDB schemas can use aliases.** Before, MongoDB refused any field
typed by an alias.

**The same in TypeScript.** An alias is a constant:

```ts
const UpdatedAt = field.column(type.TimestampString(3)).onCreate(gen.now()).onUpdate(gen.now());

updatedAt: UpdatedAt,
createdAt: field.column(type.temporal.CreatedAt()),
```

`type.*` now has a helper for every type PSL can write, such as
`type.VarChar(64)`. The `types` key in `defineContract`, which declared
aliases, is removed. Using it is an error that says what to write
instead.

## What users must do

Every contract that uses a `types {}` block gets a new storage hash,
because its columns change shape. The PR ships an upgrade script,
`upgrade-instructions/pending/expand-type-aliases/`.
- **What the script does:** it rewrites a project's stored contracts and
migration snapshots to the new shape and updates their hashes.
- **What the user does:** run the script, emit the contract again, then
run `prisma db sign`.
- **The database itself:** nothing changes, and no migration is needed.

Without the upgrade, Prisma refuses a stored contract that still holds
an alias, and the error names the script.

Extension authors have a separate guide in the same folder.

## How it was checked

- **No database change.** Every saved migration plan and every example
migration produces the same SQL as before. Only hashes changed.
- **The upgrade script.** Run over this repository, it produced exactly
what emitting the contracts again produces. Run over `main`'s demo apps,
it produced this branch's migrations. Its tests run Prisma's own
migration checker on the result.
- **A real upgrade, by hand.** A database was set up with `main` and
then upgraded with this branch by following the guide. `prisma db
verify` reports no issues. The report is
`projects/remove-field-presets/manual-qa-reports/2026-10-21-slice-2.md`.
- **Review.** Four rounds of `/drive-code-review`, all findings fixed.
All repository checks pass.

## Decisions ADR 275 left open

- **Extensions still declare database types in TypeScript.** pgvector
and PostGIS declare the types they create in the database (`vector`,
`geometry`) through the removed `types` key, and PSL cannot write that.
They now use a new key, `databaseTypes`, which means only that. Their
contracts do not change.
- **A provided alias cannot set a database default.** No pack needs one,
and MongoDB has no database defaults. It can be added when a pack needs
it.
- **MongoDB's aliases use `Date`,** because MongoDB's `DateTime` is
deprecated.
- **MongoDB's TypeScript builder gets no provided aliases.** It has no
`type.*` helpers to build them on. MongoDB TypeScript users write
`field.date().onCreate(gen.now()).onUpdate(gen.now())`. This is recorded
in `projects/remove-field-presets/deferred.md`.

ADR 275 and the ADRs it changes carry dated notes on these points.

## Alternatives considered

- **Keep storing aliases in the contract.** Not chosen: the hash would
keep changing when a user renames an alias, though the database does not
change.
- **Split this PR into the schema-language change and the contract
change.** Not chosen: an alias that sets a generated value only works
once aliases are resolved when the schema is read, so the second PR
would depend on the first.
- **Keep the TypeScript key named `types` for extensions.** Not chosen:
every existing `types` key in a user's app holds aliases, and would
silently become a declaration of database types.

TML-3607 stays open until the third PR merges.

Agent: frankenstein-64

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric wmadden-electric mentioned this pull request Oct 22, 2026
TML-3607: Field presets are removed, and each is written with a type constructor or type alias that stores the same contract #30845
Merged
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-prisma__orm that referenced this pull request Oct 27, 2026
@wmadden-electric
TML-3607: Field presets are removed, and each is written with a type …
9adf620
…constructor or type alias that stores the same contract (prisma#30845)

## At a glance

Before this PR, a Prisma 8 schema could write a field with a *field
preset*, a single call that set the column type, the identity and the
generated values at once:

```prisma
model User {
  id        id.ulid()
  updatedAt temporal.updatedAt()
  posts     Post[]
}

model Post {
  id       id.ulid()
  authorId ulid()
  author   User @relation(fields: [authorId], references: [id])
}
```

After this PR, field presets no longer exist. The same fields are
written with the type constructors, type aliases and attributes the rest
of a schema already uses:

```prisma
model User {
  id        Ulid               @id @onCreate(ulid())
  updatedAt temporal.UpdatedAt
  posts     Post[]
}

model Post {
  id       Ulid @id @onCreate(ulid())
  authorId Ulid
  author   User @relation(fields: [authorId], references: [id])
}
```

`Ulid` is a new type alias for `Char(26)`, the column a ULID is stored
in. The id and the foreign key use the same alias, so nobody writes the
length 26. The new form stores exactly the same contract, so the storage
and execution hashes do not change. A user only rewrites the calls;
nothing is re-emitted, signed again or migrated.

The same holds in TypeScript: `field.id.ulid()` becomes
`field.column(type.Ulid()).id().onCreate(gen.ulid())`.

## The decision

ADR 275 decided to remove field presets. This PR, the third and last for
TML-3607, carries that out:

- **Earlier PRs:** prisma#30780 made generated values attributes (`@onCreate`,
`@onUpdate`), and prisma#30819 let type aliases carry those attributes, adding
the ready-made aliases `temporal.CreatedAt` and `temporal.UpdatedAt`.
- **This PR:** with replacements in place, it removes the presets
themselves, in PSL, in both TypeScript builders (SQL and MongoDB), and
in the framework.

Presets were a second way to write what attributes already say, with
their own argument forms such as the bare `now` in `onCreate: now`.
Their authors also paired a column codec with a generator by hand, which
once wrote a JavaScript `Date` into a text column. Attributes and
aliases cover the same ground, and any user can write them.

## A type alias for each generated identifier

Identifier presets were the main reason presets existed: a user wrote
`id.ulid()` and never needed to know a ULID is stored in `Char(26)`. So
this PR adds a type alias for each identifier column. ADR 310 explains
the design.

| Alias | Stands for | A generating field writes |
|---|---|---|
| `UuidString` | `Char(36)` | `@onCreate(uuid())` or
`@onCreate(uuid(7))` |
| `Ulid` | `Char(26)` | `@onCreate(ulid())` |
| `Nanoid` | `Char(21)` | `@onCreate(nanoid())` |
| `Cuid2` | `Char(24)` | `@onCreate(cuid(2))` |
| `Ksuid` | `Char(27)` | `@onCreate(ksuid())` |

- **The alias names the column only.** A foreign key holds a copy of the
id, so it needs the same column and must not generate a value. The id
field writes `@id` and its generator itself.
- **Where the names live.** The SQL family provides them as `sql.Ulid`
and so on, on Postgres, SQLite and MySQL. Postgres also has them as
top-level names, like its other column types `Char` and `Uuid`. In
TypeScript they are `type.Ulid()` and `type.sql.Ulid()`.
- **A one-word id is a mixin the user writes:** `model mixin UlidId { id
Ulid @id @onCreate(ulid()) }`, then `+UlidId`. The upgrade guide shows
it, with the TypeScript constant `const UlidId =
field.column(type.Ulid()).id().onCreate(gen.ulid());`.
- **Native UUIDs need no alias.** On Postgres, `Uuid @id
@onCreate(uuid(7))` is the recommended form, and the `prisma init`
Postgres TypeScript starter now uses it.

## What a user sees

**PSL refuses every preset with its exact rewrite.** For example:

```text
PSL_UNRESOLVED_REFERENCE: id.ulid() was a field preset, and Prisma 8 removed field presets. Write Ulid @id @onCreate(ulid()).
```

On SQLite the rewrite is `sql.Ulid @id @onCreate(ulid())`. On Postgres,
a schema that declares its own `model Ulid` gets the `sql.Ulid` form,
because its model hides the top-level name.

**The refusal is shown in a schema with relations.** Before, a field
whose type did not resolve was dropped, and the contract build then
threw a relation error, such as `CONTRACT.RELATION_INVALID: Relation
"User.posts" joins on column "id" ...`, which hid the real diagnostic.
Now field resolution records every field it drops, and the build stops
before it runs. The user sees the refusal with its rewrite. This applies
to any unresolved field type, not only presets.

**An unknown bare type name suggests the name in a namespace.** On
SQLite, `Ulid` gives `Cannot find type "Ulid". Did you mean sql.Ulid?`.

**TypeScript refuses a preset twice.** It is a compile error, because
the helper no longer exists. If a contract still calls one at run time,
for example through `contract emit` before `tsc`, the read throws
`CONTRACT.FIELD_HELPER_UNKNOWN` with the same rewrite. Before this, the
user got `Cannot read properties of undefined`. The run-time check
answers only the removed preset names and adds nothing to the public
types.

**An extension that still contributes presets is refused.** A pack with
an `authoring.field` namespace fails with
`CONTRACT.PACK_CONTRIBUTION_INVALID`, and the message says to contribute
a type alias instead.

**A new SQL type constructor, `sql.Char(length)`, on every SQL target.**
SQLite stored its identifier presets as a fixed-length text column but
had no way to write that type. Now `sql.Char(36)` works on Postgres,
SQLite and MySQL.

**The upgrade guide** is
`upgrade-instructions/pending/remove-field-presets/`, for apps and for
extension authors. It has a before-and-after table for every preset in
every target and both TypeScript builders. It opens by saying which
advice from the 8.0.0-rc.19 guide no longer holds.

## What was removed

- The `fieldPreset` descriptor kind, the `authoring.field` namespace,
and every preset map in the SQL family, Postgres, SQLite and MongoDB.
- `field.generated(...)` and the `@internal/ids` helpers that bundled a
column type with a generator.
- The `option`, `number` and `object` argument kinds, the `select`
template, and the two text parsers only those used. Only the `value`
argument kind remains.
- The preset branches of the language server.
- The `projects/remove-field-presets/` folder, now that the project is
done. Its long-lived content moved into ADR 275's amendment, ADR 310 and
the Data Contract doc.

## How it was checked

- **Same contracts.** A parity test runs every preset (on Postgres,
SQLite and MongoDB) through the real emit pipeline and checks that its
replacement stores the same contract. For PSL, it takes the rewrite from
the refusal message itself and checks that. For TypeScript, a sibling
test does the same for every rewrite. Another test checks that a key and
a foreign key typed by each alias emit the same contract as `Char(n)`.
`fixtures:check` shows no contract change across the repository.
- **Real upgrades by hand.** Projects that used presets, on Postgres and
MongoDB in PSL and TypeScript, were upgraded by following the guide, and
came out with the old hashes. Manual QA of the aliases ran the built CLI
on Postgres and SQLite projects: each alias in every form, the refusals
with and without relations, the length check, TypeScript type checking,
`prisma init`, `contract print`, and every example in the guide.
- **New projects.** Each `prisma init` starter writes no preset, and a
test pins its contract hashes. The Postgres TypeScript starter's storage
hash changes, because its ids move to the native `uuid` column. This
affects only new projects.
- **Review.** Six rounds of `/drive-code-review` and two rounds of
manual QA; every in-scope finding is fixed.
- **Checks.** Every CI lint step and coverage pass, along with all
related integration files, run one at a time.
- **Examples.** Merging main's renamed Postgres date and time types
(`TimestamptzTemporal`, `TimestampTemporal`) broke two files in
`examples/prisma-8-demo`. They are updated with the rename only.

The framework vocabulary check counts SQL and MongoDB words inside
`packages/1-framework`. This PR lowers that count from 236 to 218. It
adds two counted lines: the `prisma init` templates now write
`field.column(...)`. Those templates were already SQL code inside the
framework CLI. Moving them out needs a new framework interface, which is
TML-3702.

## Follow-ups

- **TML-3702:** move the `prisma init` templates out of the framework
CLI.
- **TML-3705:** a contributed type alias cannot take arguments, so
`temporal.UpdatedAt` has no form with a precision, and a nanoid of
another size has no alias.
- **TML-3706:** the MongoDB TypeScript builder has no `type.*` helpers,
so it cannot use contributed aliases. MongoDB TypeScript users write
`field.date().onCreate(gen.now()).onUpdate(gen.now())`.
- **TML-3707:** generator descriptors share a structure with the default
functions, which leaves five empty registries.
- **TML-3751:** the rule that decides whether a rewrite applies on a
target is written twice, once for PSL and once in the SQL TypeScript
package, because that package cannot import the PSL parser.
- **TML-3752:** a model named like a type, such as `model Ulid { id Ulid
@id }`, fails with an error that does not mention the name clash.
- **TML-3753:** a TypeScript contract that was never type-checked and
uses a name its target lacks, such as `type.Ulid()` on SQLite, fails
with a raw `type.Ulid is not a function`.
- **TML-3754:** the "Did you mean" suggestion lives in the SQL family's
unresolved-type hook, so MongoDB schemas do not get it, and it does not
cover calls such as `Foo(3)`.

## Alternatives considered

- **Keep presets as a shorthand beside attributes.** Not chosen: two
ways to write one thing, and presets were available to packs only, not
users.
- **An identifier alias that carries the generator too.** Not chosen: a
foreign key needs the same column without a generator, so each format
would need two aliases. ADR 310 covers this and the naming alternatives.
- **TypeScript stubs that throw when called.** Not chosen: they would
keep every preset name in the public types. The run-time check answers
removed names only, through the object, and the types stay clean.
- **Move the `prisma init` template text into files the vocabulary check
skips.** Not chosen: that would hide the lines from the check without
moving the SQL code out of the framework. TML-3702 tracks the real move.

Closes TML-3607.

Agent: frankenstein-64

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@wmadden wmadden wmadden approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@wmadden-electric @wmadden
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.