@prisma/orm-mysql 0.0.0-stage → 8.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +44 -2
- package/dist/adapter.d.mts +1 -0
- package/dist/adapter.mjs +2 -0
- package/dist/adapter__adapter.d.mts +1 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__codec-types.d.mts +1 -0
- package/dist/adapter__codec-types.mjs +2 -0
- package/dist/adapter__control.d.mts +3 -0
- package/dist/adapter__control.mjs +3 -0
- package/dist/adapter__runtime.d.mts +3 -0
- package/dist/adapter__runtime.mjs +3 -0
- package/dist/builder.d.mts +1 -0
- package/dist/builder.mjs +2 -0
- package/dist/builder__runtime.d.mts +1 -0
- package/dist/builder__runtime.mjs +2 -0
- package/dist/builder__types.d.mts +1 -0
- package/dist/builder__types.mjs +2 -0
- package/dist/components.d.mts +1 -0
- package/dist/components.mjs +2 -0
- package/dist/components__authoring.d.mts +1 -0
- package/dist/components__authoring.mjs +2 -0
- package/dist/components__codec.d.mts +1 -0
- package/dist/components__codec.mjs +2 -0
- package/dist/components__components.d.mts +1 -0
- package/dist/components__components.mjs +2 -0
- package/dist/components__control.d.mts +1 -0
- package/dist/components__control.mjs +2 -0
- package/dist/components__emission.d.mts +1 -0
- package/dist/components__emission.mjs +2 -0
- package/dist/components__execution.d.mts +1 -0
- package/dist/components__execution.mjs +2 -0
- package/dist/components__ir.d.mts +1 -0
- package/dist/components__ir.mjs +2 -0
- package/dist/components__psl-ast.d.mts +1 -0
- package/dist/components__psl-ast.mjs +2 -0
- package/dist/components__runtime.d.mts +1 -0
- package/dist/components__runtime.mjs +2 -0
- package/dist/components__utils.d.mts +1 -0
- package/dist/components__utils.mjs +2 -0
- package/dist/config.d.mts +22 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +41 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract-builder.d.mts +192 -0
- package/dist/contract-builder.d.mts.map +1 -0
- package/dist/contract-builder.mjs +37 -0
- package/dist/contract-builder.mjs.map +1 -0
- package/dist/contract.d.mts +1 -0
- package/dist/contract.mjs +2 -0
- package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -0
- package/dist/contract__apply-specifier-default-control-policy.mjs +2 -0
- package/dist/contract__contract-validation-error.d.mts +1 -0
- package/dist/contract__contract-validation-error.mjs +2 -0
- package/dist/contract__default-namespace.d.mts +1 -0
- package/dist/contract__default-namespace.mjs +2 -0
- package/dist/contract__enum-accessor.d.mts +1 -0
- package/dist/contract__enum-accessor.mjs +2 -0
- package/dist/contract__hashing-utils.d.mts +1 -0
- package/dist/contract__hashing-utils.mjs +2 -0
- package/dist/contract__hashing.d.mts +1 -0
- package/dist/contract__hashing.mjs +2 -0
- package/dist/contract__is-plain-record.d.mts +1 -0
- package/dist/contract__is-plain-record.mjs +2 -0
- package/dist/contract__resolve-domain-model.d.mts +1 -0
- package/dist/contract__resolve-domain-model.mjs +2 -0
- package/dist/contract__types.d.mts +1 -0
- package/dist/contract__types.mjs +2 -0
- package/dist/contract__validate-domain.d.mts +1 -0
- package/dist/contract__validate-domain.mjs +2 -0
- package/dist/contract__validate-once.d.mts +1 -0
- package/dist/contract__validate-once.mjs +2 -0
- package/dist/contract__validate-storage.d.mts +1 -0
- package/dist/contract__validate-storage.mjs +2 -0
- package/dist/control.d.mts +12 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +22 -0
- package/dist/control.mjs.map +1 -0
- package/dist/driver.d.mts +1 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +3 -0
- package/dist/driver__control.mjs +3 -0
- package/dist/driver__runtime.d.mts +3 -0
- package/dist/driver__runtime.mjs +3 -0
- package/dist/family-contract.d.mts +1 -0
- package/dist/family-contract.mjs +2 -0
- package/dist/family-contract__authored-check-naming.d.mts +1 -0
- package/dist/family-contract__authored-check-naming.mjs +2 -0
- package/dist/family-contract__canonicalization-hooks.d.mts +1 -0
- package/dist/family-contract__canonicalization-hooks.mjs +2 -0
- package/dist/family-contract__check-expressions.d.mts +1 -0
- package/dist/family-contract__check-expressions.mjs +2 -0
- package/dist/family-contract__codec-json-type.d.mts +1 -0
- package/dist/family-contract__codec-json-type.mjs +2 -0
- package/dist/family-contract__contract-view.d.mts +1 -0
- package/dist/family-contract__contract-view.mjs +2 -0
- package/dist/family-contract__data-type-support.d.mts +1 -0
- package/dist/family-contract__data-type-support.mjs +2 -0
- package/dist/family-contract__data-type.d.mts +1 -0
- package/dist/family-contract__data-type.mjs +2 -0
- package/dist/family-contract__entity-handle-lowering-hook.d.mts +1 -0
- package/dist/family-contract__entity-handle-lowering-hook.mjs +2 -0
- package/dist/family-contract__entity-kinds.d.mts +1 -0
- package/dist/family-contract__entity-kinds.mjs +2 -0
- package/dist/family-contract__factories.d.mts +1 -0
- package/dist/family-contract__factories.mjs +2 -0
- package/dist/family-contract__foreign-key-materialization.d.mts +1 -0
- package/dist/family-contract__foreign-key-materialization.mjs +2 -0
- package/dist/family-contract__generated-id-column-aliases.d.mts +1 -0
- package/dist/family-contract__generated-id-column-aliases.mjs +2 -0
- package/dist/family-contract__index-naming.d.mts +1 -0
- package/dist/family-contract__index-naming.mjs +2 -0
- package/dist/family-contract__index-type-validation.d.mts +1 -0
- package/dist/family-contract__index-type-validation.mjs +2 -0
- package/dist/family-contract__index-types.d.mts +1 -0
- package/dist/family-contract__index-types.mjs +2 -0
- package/dist/family-contract__referential-action-sql.d.mts +1 -0
- package/dist/family-contract__referential-action-sql.mjs +2 -0
- package/dist/family-contract__resolve-storage-table.d.mts +1 -0
- package/dist/family-contract__resolve-storage-table.mjs +2 -0
- package/dist/family-contract__sql-expression.d.mts +1 -0
- package/dist/family-contract__sql-expression.mjs +2 -0
- package/dist/family-contract__types.d.mts +1 -0
- package/dist/family-contract__types.mjs +2 -0
- package/dist/family-contract__validators.d.mts +1 -0
- package/dist/family-contract__validators.mjs +2 -0
- package/dist/family-contract__value-set-derivation-hook.d.mts +1 -0
- package/dist/family-contract__value-set-derivation-hook.mjs +2 -0
- package/dist/family-runtime.d.mts +1 -0
- package/dist/family-runtime.mjs +2 -0
- package/dist/family-runtime__internal__prepared-query.d.mts +1 -0
- package/dist/family-runtime__internal__prepared-query.mjs +2 -0
- package/dist/family__control-adapter.d.mts +1 -0
- package/dist/family__control-adapter.mjs +2 -0
- package/dist/family__control.d.mts +3 -0
- package/dist/family__control.mjs +3 -0
- package/dist/family__diff.d.mts +1 -0
- package/dist/family__diff.mjs +2 -0
- package/dist/family__ir.d.mts +1 -0
- package/dist/family__ir.mjs +2 -0
- package/dist/family__migration.d.mts +1 -0
- package/dist/family__migration.mjs +2 -0
- package/dist/family__pack.d.mts +3 -0
- package/dist/family__pack.mjs +3 -0
- package/dist/family__psl-build.d.mts +1 -0
- package/dist/family__psl-build.mjs +2 -0
- package/dist/family__psl-infer.d.mts +1 -0
- package/dist/family__psl-infer.mjs +2 -0
- package/dist/family__runtime.d.mts +3 -0
- package/dist/family__runtime.mjs +3 -0
- package/dist/family__verify.d.mts +1 -0
- package/dist/family__verify.mjs +2 -0
- package/dist/migration-tools__aggregate.d.mts +1 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +1 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__hash.d.mts +1 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__io.d.mts +1 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +1 -0
- package/dist/migration-tools__spaces.mjs +2 -0
- package/dist/migration.d.mts +1 -0
- package/dist/migration.mjs +2 -0
- package/dist/mysql-static-DcYvSThw-BMxDuGkP.mjs +83 -0
- package/dist/mysql-static-DcYvSThw-BMxDuGkP.mjs.map +1 -0
- package/dist/mysql-uiFioAtk-BuXtMcWO.d.mts +100 -0
- package/dist/mysql-uiFioAtk-BuXtMcWO.d.mts.map +1 -0
- package/dist/orm-client.d.mts +1 -0
- package/dist/orm-client.mjs +2 -0
- package/dist/relational-core.d.mts +1 -0
- package/dist/relational-core.mjs +2 -0
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -0
- package/dist/relational-core__aggregate-descriptor-registry.mjs +2 -0
- package/dist/relational-core__ast.d.mts +1 -0
- package/dist/relational-core__ast.mjs +2 -0
- package/dist/relational-core__codec-descriptor-registry.d.mts +1 -0
- package/dist/relational-core__codec-descriptor-registry.mjs +2 -0
- package/dist/relational-core__collection-methods.d.mts +1 -0
- package/dist/relational-core__collection-methods.mjs +2 -0
- package/dist/relational-core__contract-free.d.mts +1 -0
- package/dist/relational-core__contract-free.mjs +2 -0
- package/dist/relational-core__expression.d.mts +1 -0
- package/dist/relational-core__expression.mjs +2 -0
- package/dist/relational-core__functions.d.mts +1 -0
- package/dist/relational-core__functions.mjs +2 -0
- package/dist/relational-core__index-reference.d.mts +1 -0
- package/dist/relational-core__index-reference.mjs +2 -0
- package/dist/relational-core__middleware.d.mts +1 -0
- package/dist/relational-core__middleware.mjs +2 -0
- package/dist/relational-core__plan.d.mts +1 -0
- package/dist/relational-core__plan.mjs +2 -0
- package/dist/relational-core__query-lane-context.d.mts +1 -0
- package/dist/relational-core__query-lane-context.mjs +2 -0
- package/dist/relational-core__types.d.mts +1 -0
- package/dist/relational-core__types.mjs +2 -0
- package/dist/runtime.d.mts +24 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +266 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/schema-ir__types.d.mts +1 -0
- package/dist/schema-ir__types.mjs +2 -0
- package/dist/static.d.mts +25 -0
- package/dist/static.d.mts.map +1 -0
- package/dist/static.mjs +2 -0
- package/dist/target__codec-descriptor.d.mts +1 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +1 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +1 -0
- package/dist/target__codec-types.mjs +2 -0
- package/dist/target__codecs.d.mts +1 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__contract-free.d.mts +1 -0
- package/dist/target__contract-free.mjs +2 -0
- package/dist/target__control-tables.d.mts +1 -0
- package/dist/target__control-tables.mjs +2 -0
- package/dist/target__control.d.mts +3 -0
- package/dist/target__control.mjs +3 -0
- package/dist/target__data-types.d.mts +1 -0
- package/dist/target__data-types.mjs +2 -0
- package/dist/target__ddl.d.mts +1 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +1 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__errors.d.mts +1 -0
- package/dist/target__errors.mjs +2 -0
- package/dist/target__marker-lock.d.mts +1 -0
- package/dist/target__marker-lock.mjs +2 -0
- package/dist/target__migration.d.mts +1 -0
- package/dist/target__migration.mjs +2 -0
- package/dist/target__pack.d.mts +3 -0
- package/dist/target__pack.mjs +3 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +3 -0
- package/dist/target__sql-utils.d.mts +1 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/utils.d.mts +1 -0
- package/dist/utils.mjs +2 -0
- package/dist/utils__abortable.d.mts +1 -0
- package/dist/utils__abortable.mjs +2 -0
- package/dist/utils__array-equal.d.mts +1 -0
- package/dist/utils__array-equal.mjs +2 -0
- package/dist/utils__assertions.d.mts +1 -0
- package/dist/utils__assertions.mjs +2 -0
- package/dist/utils__canonical-stringify.d.mts +1 -0
- package/dist/utils__canonical-stringify.mjs +2 -0
- package/dist/utils__casts.d.mts +1 -0
- package/dist/utils__casts.mjs +2 -0
- package/dist/utils__defined.d.mts +1 -0
- package/dist/utils__defined.mjs +2 -0
- package/dist/utils__hash-content.d.mts +1 -0
- package/dist/utils__hash-content.mjs +2 -0
- package/dist/utils__internal-error.d.mts +1 -0
- package/dist/utils__internal-error.mjs +2 -0
- package/dist/utils__json.d.mts +1 -0
- package/dist/utils__json.mjs +2 -0
- package/dist/utils__promise.d.mts +1 -0
- package/dist/utils__promise.mjs +2 -0
- package/dist/utils__redact-db-url.d.mts +1 -0
- package/dist/utils__redact-db-url.mjs +2 -0
- package/dist/utils__result.d.mts +1 -0
- package/dist/utils__result.mjs +2 -0
- package/dist/utils__simplify-deep.d.mts +1 -0
- package/dist/utils__simplify-deep.mjs +2 -0
- package/dist/utils__structured-error.d.mts +1 -0
- package/dist/utils__structured-error.mjs +2 -0
- package/dist/utils__suppress-idle-connection-errors.d.mts +1 -0
- package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
- package/dist/utils__text.d.mts +1 -0
- package/dist/utils__text.mjs +2 -0
- package/dist/utils__types.d.mts +1 -0
- package/dist/utils__types.mjs +2 -0
- package/dist/vite-plugin-contract-emit.d.mts +1 -0
- package/dist/vite-plugin-contract-emit.mjs +2 -0
- package/package.json +175 -3
- package/skills/prisma-8/SKILL.md +100 -0
- package/skills/prisma-8/references/build.md +142 -0
- package/skills/prisma-8/references/contract.md +548 -0
- package/skills/prisma-8/references/debug.md +150 -0
- package/skills/prisma-8/references/feedback.md +251 -0
- package/skills/prisma-8/references/migration-model.md +179 -0
- package/skills/prisma-8/references/migration-review.md +211 -0
- package/skills/prisma-8/references/migrations.md +622 -0
- package/skills/prisma-8/references/queries-mongo.md +238 -0
- package/skills/prisma-8/references/queries-postgres.md +710 -0
- package/skills/prisma-8/references/queries.md +253 -0
- package/skills/prisma-8/references/quickstart.md +317 -0
- package/skills/prisma-8/references/runtime.md +463 -0
- package/skills/prisma-8/references/supabase.md +234 -0
- package/skills/prisma-8/references/upgrade-app.md +102 -0
- package/skills/prisma-8/references/upgrade-extension.md +108 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.10-to-0.11/instructions.md +56 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +381 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts +202 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts +201 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts +198 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/instructions.md +339 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts +229 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/instructions.md +543 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.14-to-0.15/instructions.md +359 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.15-to-0.16/instructions.md +173 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/instructions.md +805 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md +72 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.7-to-0.8/instructions.md +8 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/instructions.md +36 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/instructions.md +86 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +588 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +639 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/multifile-psl/add-use-prisma-8-directive.mjs +60 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +332 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +489 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +1368 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +108 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +755 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +973 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/scripts/sql-expression-literals-psl/rewrite-sql-strings.mjs +271 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +1862 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +597 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1120 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +304 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +513 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1206 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +802 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +158 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +42 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +157 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +36 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +63 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +84 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +276 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +738 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts +97 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts +223 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.12-to-0.13/instructions.md +266 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/instructions.md +522 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.14-to-0.15/instructions.md +803 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.15-to-0.16/instructions.md +219 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/instructions.md +731 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md +194 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.7-to-0.8/instructions.md +8 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/instructions.md +57 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/instructions.md +150 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +746 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +857 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +504 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +143 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +2168 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +223 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +583 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +1008 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +2186 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +597 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1120 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +304 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +381 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1206 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +570 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +137 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +129 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +102 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +35 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +86 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +63 -0
package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md
ADDED
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.20"
|
|
3
|
+
to: "8.0.0-rc.21"
|
|
4
|
+
changes:
|
|
5
|
+
- id: client-members-reject-instead-of-throwing
|
|
6
|
+
summary: |
|
|
7
|
+
A client member that returns a promise or a result no longer throws at the call when the client or the transaction is in a failed state. On `postgres()`, `sqlite()`, a `supabase()` role-bound client and a transaction, `query`, `execute`, `prepare`, `transaction`, ORM calls and a prepared statement's `query(target, params)` and `execute(target, params)` now report a closed client, a failed connection or an ended transaction through what they return: the promise rejects, and a result rejects when it is awaited or read. Error codes and messages do not change. Code that wraps such a call in `try`/`catch` without awaiting it no longer catches the error; add `await`, or handle it with `.catch(...)`. `db.runtime()` still throws at the call, and so does a mistake in the call itself, such as an ORM query the database's capabilities do not allow. The detection matches a file that imports an `@prisma/orm-*` package and has a `try` block, one line or many, nested or not, that calls one of these members or an ORM terminal (`all`, `first`, `create`, `update`, `delete`, `upsert`, …) without `await` directly before it, on a receiver shaped like a client: a name ending in `db`, `tx`, a name ending in `client`, `admin`, a prepared statement, or a chain through `.orm`; chains may span lines and take callbacks; leave a call whose result is awaited or returned to an awaiting caller as it is.
|
|
8
|
+
detection:
|
|
9
|
+
glob: "**/*.{ts,mts,cts,tsx,js,mjs,cjs}"
|
|
10
|
+
matches:
|
|
11
|
+
- '(?<![\s\S])(?=[\s\S]*[\x27\x22]@prisma/orm-)[\s\S]*\btry\s*\{(?:(?!\}\s*(?:catch|finally)\b)[\s\S])*?(?<![\w$.])(?<!\bawait\s+)(?:this\s*\.\s*)?(?:[\w$]*(?:db|Db|DB)|tx|trx|[\w$]*[Cc]lient|admin|[\w$]*[Pp]repared[\w$]*|[\w$]+\s*\.\s*orm)(?:\s*\.\s*[\w$]+(?:\s*\((?:[^()]|\([^()]*\))*\))?)*?\s*\.\s*(?:query|execute|prepare|transaction|all|first|firstOrThrow|create|createAll|createAndCount|update|updateAll|updateAndCount|delete|deleteAll|deleteAndCount|upsert|aggregate)\s*\('
|
|
12
|
+
- id: lazy-activity-source-rejects
|
|
13
|
+
summary: |
|
|
14
|
+
`lazyActivitySource(source)` and `delegatingActivitySource(target)` now reject from `startActivity` and `planContentHash` when `source()` or `target()` throws, instead of throwing at the call. A transaction context from `withTransaction` and its activity handles report `RUNTIME.TRANSACTION_CLOSED` from `query` and from the prepared-statement bridges through the result they return. No code change is needed unless your code caught these errors with a synchronous `try`/`catch`.
|
|
15
|
+
- id: control-adapter-marker-location
|
|
16
|
+
summary: |
|
|
17
|
+
`SqlControlAdapter` (from `@prisma/orm-family-sql/family/control-adapter`) and `MongoControlAdapter` (from `@prisma/orm-family-mongo/family/control-adapter`) have a new required field, `markerLocation`: the name of the table or collection that holds the contract markers, which messages show the user. `ControlFamilyInstance` (from `@prisma/orm-framework/components/control`) has it too; the SQL and Mongo families read it from the control adapter.
|
|
18
|
+
detection:
|
|
19
|
+
glob: "**/*.{ts,tsx,mts,cts}"
|
|
20
|
+
matches:
|
|
21
|
+
- '(?<![\s\S])(?![\s\S]*markerLocation)(?=[\s\S]*\b(?:SqlControlAdapter|MongoControlAdapter)\b)[\s\S]*\breadMarker\s*[(:]'
|
|
22
|
+
- '(?<![\s\S])(?![\s\S]*markerLocation)(?=[\s\S]*\bControlFamilyInstance\b)[\s\S]*\bstorageNameOf\s*[(:]'
|
|
23
|
+
- id: control-adapter-hold-marker-lock
|
|
24
|
+
summary: |
|
|
25
|
+
`SqlControlAdapter` has a new optional method, `holdMarkerLock(driver, work)`. A target whose DDL ends an open transaction provides it: `db sign` then creates the marker table under that lock, outside the transaction that writes the markers. Without it, `db sign` takes the lock with `lockMarker` and creates the marker table inside that transaction, as before.
|
|
26
|
+
- id: verify-contract-spaces-marker-location
|
|
27
|
+
summary: |
|
|
28
|
+
`verifyContractSpaces` (from the `spaces` subpath of the migration tools) takes a required `markerLocation`, the name of the target's marker table or collection, which the remediation of an orphan marker names.
|
|
29
|
+
detection:
|
|
30
|
+
glob: "**/*.{ts,tsx,mts,cts,js,mjs,cjs}"
|
|
31
|
+
matches:
|
|
32
|
+
- '(?<![\w$])verifyContractSpaces\s*\('
|
|
33
|
+
- id: plan-target-details-schema-optional
|
|
34
|
+
summary: |
|
|
35
|
+
`SqlPlanTargetDetails.schema` (from `@prisma/orm-family-sql/family/control`) is optional, and SQLite operations no longer carry `schema: 'main'`. Code that reads `target.details.schema` handles `undefined`.
|
|
36
|
+
detection:
|
|
37
|
+
glob: "**/*.{ts,tsx,mts,cts}"
|
|
38
|
+
matches:
|
|
39
|
+
- '\.details\??\.schema(?![\w$])'
|
|
40
|
+
- id: enum-value-rename-statement
|
|
41
|
+
summary: |
|
|
42
|
+
`ResolvedRenameStatement` from `@prisma/orm-framework/components/control` gains `ResolvedEnumValueRenameStatement`, `{ kind: 'rename', entity: 'enumValue', from, to }`, whose sides are `EnumValueCoordinate`s (`namespaceId`, `enum`, `member`). `MigrationSubject` gains `{ kind: 'enumValue' }` with the same coordinate. Code that switches over a rename's `entity` or a subject's `kind` handles `'enumValue'`.
|
|
43
|
+
detection:
|
|
44
|
+
glob: "**/*.{ts,mts,cts}"
|
|
45
|
+
matches:
|
|
46
|
+
- '(?<![\w$])(?:ResolvedRenameStatement|ResolvedMigrationStatement|MigrationSubject)(?![\w$])'
|
|
47
|
+
- id: rows-holding-value-and-keep-data-edit
|
|
48
|
+
summary: |
|
|
49
|
+
Three optional fields let a target say how to keep data that a removed enum value would lose. `MigrationRunnerFailureMeta.rowsHoldingValue` (`RowsHoldingValue`: `enumValue`, `value`, `rows`, `operationIndex`, `keepDataEdit?`) reports the rows that still hold a stored value a removal check refused to remove. `MigrationDataLoss.keepDataEdit` (`KeepDataEdit`: `remove`, `replaceWith`, `swapsValues?`) names the edit to `migration.ts` that keeps the data of a planned loss. `MigrationPlannerConflict.leaveOut` lists the statements to leave out of a plan whose `migration.ts` the user finishes by hand. All three are optional: a target that sets none of them keeps working, and the CLI then gives only its general advice.
|
|
50
|
+
detection:
|
|
51
|
+
glob: "**/*.{ts,mts,cts}"
|
|
52
|
+
matches:
|
|
53
|
+
- '(?<![\w$])(?:MigrationRunnerFailureMeta|MigrationDataLoss|MigrationRunnerFailure|MigrationPlannerConflict)(?![\w$])'
|
|
54
|
+
- id: contract-source-warnings
|
|
55
|
+
summary: |
|
|
56
|
+
A contract source's warnings now reach the caller when the source then fails. `loadContractSource` (`@prisma/orm-toolchain/cli/control-api`) no longer takes `onWarning`; it returns `{ contract, warnings }` on success and adds `warnings` to its failure. The control client's `emit` failure (`EmitFailure`) gains `sourceWarnings`, as its success already had. Read `result.value.contract` where you read `result.value`, and report `warnings` instead of passing `onWarning`.
|
|
57
|
+
detection:
|
|
58
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
59
|
+
matches:
|
|
60
|
+
- '\bloadContractSource\('
|
|
61
|
+
- id: mongo-contract-target-option
|
|
62
|
+
summary: |
|
|
63
|
+
`mongoContract(schemaPath, options)` now requires `options.target`, the MongoDB target pack, which the contract records. Pass `{ target: mongoTargetPack }` with `mongoTargetPack` imported from `@prisma/orm-target-mongo/target/pack` (or `@prisma/orm-mongo/target/pack`), alongside any options you already pass. A config written with `defineConfig` from `@prisma/orm-mongo/config` needs no change.
|
|
64
|
+
detection:
|
|
65
|
+
glob: "**/*.{ts,mts,cts,js,mjs}"
|
|
66
|
+
matches:
|
|
67
|
+
- '(?<![\w$.])mongoContract\(\s*[^,()]*(?:\([^()]*\)[^,()]*)*,?\s*\)'
|
|
68
|
+
- '(?<![\w$.])mongoContract\(\s*[^,()]*(?:\([^()]*\)[^,()]*)*,\s*\{(?![^{}]*\btarget\b)[^{}]*\}\s*\)'
|
|
69
|
+
- '(?<![\w$.])mongoContract\(\s*[^,()]*(?:\([^()]*\)[^,()]*)*,\s*[A-Za-z_$][\w$.]*\s*\)'
|
|
70
|
+
- id: mongo-contract-input
|
|
71
|
+
summary: |
|
|
72
|
+
The MongoDB type for the object you pass to `defineContract`, `ContractDefinition`, is renamed `ContractInput`. It is the same type under SQL's name for it. `ContractDefinition` now names the plain-data definition every MongoDB contract source builds from, which takes no type parameters, so the detection flags an import from `@prisma/orm-family-mongo/contract-ts` only where the file writes `ContractDefinition<...>`. Import `ContractInput` from `@prisma/orm-mongo/contract-builder` or `@prisma/orm-family-mongo/contract-ts/contract-builder` where you imported `ContractDefinition`.
|
|
73
|
+
detection:
|
|
74
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
75
|
+
matches:
|
|
76
|
+
- '(?:import|export)\s+(?:type\s+)?\{[^}]*\bContractDefinition\b[^}]*\}\s*from\s*[\x27"]@prisma/orm-mongo/contract-builder[\x27"]'
|
|
77
|
+
- '(?:import|export)\s+(?:type\s+)?\{[^}]*\bContractDefinition\b[^}]*\}\s*from\s*[\x27"]@prisma/orm-family-mongo/contract-ts(?:/contract-builder)?[\x27"][\s\S]*\bContractDefinition<'
|
|
78
|
+
- id: mongo-model-definition-removed
|
|
79
|
+
summary: |
|
|
80
|
+
`MongoModelDefinition` is removed. It was another name for `ContractModel<MongoModelStorage>`. Write `ContractModel<MongoModelStorage>` instead, with `ContractModel` from `@prisma/orm-framework/contract/types` and `MongoModelStorage` from `@prisma/orm-family-mongo/contract`.
|
|
81
|
+
detection:
|
|
82
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
83
|
+
matches:
|
|
84
|
+
- '(?<![\w$])MongoModelDefinition(?![\w$])'
|
|
85
|
+
- id: mongo-ts-polymorphism-rules
|
|
86
|
+
summary: |
|
|
87
|
+
`defineContract` now applies the MongoDB polymorphism rules that PSL applied. It refuses a discriminator that is optional, a list or not text, such as an `Int32` field (`CONTRACT.ARGUMENT_INVALID`); a variant value the discriminator field cannot hold or that is not a member of its enum; a variant listed in `discriminator.variants` that no model declares with that base; a variant stored in another collection than its base (`CONTRACT.COLLECTION_INVALID`); and, in TypeScript and PSL, a variant field stored under a name a field of its base is stored under, such as the discriminator (`CONTRACT.NAME_DUPLICATE`, `PSL_DUPLICATE_STORED_NAME`), which would overwrite that field; and, in TypeScript and PSL, a variant field that restates a base field with a different stored name, type, nullability or list shape (`CONTRACT.ARGUMENT_INVALID`, `PSL_VARIANT_FIELD_DIFFERS_FROM_BASE`), whose documents the collection's validator, written from the base, would refuse. Make the discriminator a required `field.string()` or a string enum, list only declared variants, leave a variant's `collection` out or set it to its base's, give each variant field a stored name its base does not use, and restate a base field on a variant exactly as the base declares it, or not at all.
|
|
88
|
+
detection:
|
|
89
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
90
|
+
matches:
|
|
91
|
+
- '@prisma/orm-(?:mongo|family-mongo/contract-ts)/contract-builder[\x27"][\s\S]*\bdiscriminator\s*:\s*\{'
|
|
92
|
+
- id: mongo-index-shape-rules
|
|
93
|
+
summary: |
|
|
94
|
+
Every MongoDB contract source now refuses an index MongoDB would refuse (`CONTRACT.INDEX_INVALID` in TypeScript, `PSL_INVALID_INDEX` in PSL): a unique wildcard index, a wildcard with a hashed, 2d or 2dsphere key, a hashed index on several fields, a TTL wildcard index, a wildcard projection without a wildcard key, a collation without a locale, and a second text index in one collection. PSL also refuses an index that another model on the same collection, or the same model, already declares, such as `@unique` and `@@unique` on one field. Remove the index or change it to a shape MongoDB accepts; remove a duplicate.
|
|
95
|
+
detection:
|
|
96
|
+
glob: "**/*.{ts,mts,cts,tsx,prisma}"
|
|
97
|
+
matches:
|
|
98
|
+
- '@prisma/orm-(?:mongo|family-mongo/contract-ts)/contract-builder[\x27"][\s\S]*(?:\$\*\*|\bwildcardProjection\b|[\x27"]hashed[\x27"]|\bcollation\s*:)'
|
|
99
|
+
- '\bwildcard\('
|
|
100
|
+
- id: mongo-value-object-enum-check
|
|
101
|
+
summary: |
|
|
102
|
+
`defineContract` now refuses a value object field typed by an enum the contract does not declare (`CONTRACT.ENUM_UNKNOWN`), as it already did for a model field. Add the enum to `defineContract({ enums })`.
|
|
103
|
+
- id: mongo-newly-accepted
|
|
104
|
+
summary: |
|
|
105
|
+
No action is needed. An optional field that a type alias, `@onCreate(...)`/`@onUpdate(...)` or `.onCreate(...)`/`.onUpdate(...)` fills is now accepted, as on SQL; a list that generates a value is still refused. A TypeScript variant may leave its `collection` out and is stored in its base's.
|
|
106
|
+
- id: mongo-prisma6-merged-indexes
|
|
107
|
+
summary: |
|
|
108
|
+
A Prisma 6 schema read by `prisma6Schema()` in which one collection holds two identical indexes, such as `@unique` and `@@unique` on one field, or the same `@@index` on two models stored in one collection, now gives one index, as the database holds one. That contract's storage hash changes. Run `prisma contract emit`, then `prisma db sign` to record the new hash; the database itself needs no change.
|
|
109
|
+
- id: psl-temporal-type-renames
|
|
110
|
+
summary: |
|
|
111
|
+
On PostgreSQL, the PSL types `Timestamptz`, `Timestamp` and `Interval` are renamed to `TimestamptzTemporal`, `TimestampTemporal` and `IntervalParts`, and the old names are errors. Rename each use in your `.prisma` files, keeping its arguments: `Timestamptz(3)` becomes `TimestamptzTemporal(3)`. Each new name reads the same value with the same codec, so the contract and its hashes do not change. `@db.Timestamp` and `@db.Timestamptz` in a Prisma 7 schema are not affected.
|
|
112
|
+
detection:
|
|
113
|
+
glob: "**/*.prisma"
|
|
114
|
+
matches:
|
|
115
|
+
- '(?<![\w$.@"\x27`])(?:Timestamptz|Timestamp|Interval)(?![\w$])'
|
|
116
|
+
- id: ts-temporal-type-helpers-renamed
|
|
117
|
+
summary: |
|
|
118
|
+
In a TypeScript contract, `type.Timestamptz(...)`, `type.Timestamp(...)` and `type.Interval(...)` are renamed to `type.TimestamptzTemporal(...)`, `type.TimestampTemporal(...)` and `type.IntervalParts(...)`, and the column helper `intervalColumn(...)` from `@prisma/orm-postgres/adapter/column-types` is renamed to `intervalPartsColumn(...)`. Rename each call; the arguments do not change.
|
|
119
|
+
detection:
|
|
120
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
121
|
+
matches:
|
|
122
|
+
- '(?<![\w$])type\.(?:Timestamptz|Timestamp|Interval)\('
|
|
123
|
+
- '(?<![\w$])intervalColumn(?![\w$])'
|
|
124
|
+
- id: interval-with-precision-typed-as-parts
|
|
125
|
+
summary: |
|
|
126
|
+
An `IntervalParts(p)` column, an interval with a precision, is now typed as the `{ months, days, micros }` object its codec reads, as an interval without a precision already was, instead of a string. Type such a value as `PgInterval` from `@prisma/orm-postgres/target/codec-types`. Code that treated the value as a string was wrong at run time and now fails to type-check.
|
|
127
|
+
detection:
|
|
128
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
129
|
+
matches:
|
|
130
|
+
- 'import\s+(?:type\s+)?\{[^}]*(?<![\w$])Interval(?![\w$])[^}]*\}\s*from\s*[\x27"]@prisma/orm-postgres/(?:contract-builder|target/codec-types)[\x27"]'
|
|
131
|
+
- id: branded-time-types-removed
|
|
132
|
+
summary: |
|
|
133
|
+
The string types `Timestamp`, `Timestamptz`, `Time` and `Interval` are no longer exported from `@prisma/orm-postgres/target/codec-types` (and `Interval` no longer from `@prisma/orm-postgres/contract-builder`). No column was typed by the first three. Remove each of these names from the import that names it, and delete the import if it names nothing else. A `contract.d.ts` written by an earlier release, such as one in a migration snapshot, imports them without using them, so removing them from its import is the only change it needs.
|
|
134
|
+
detection:
|
|
135
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
136
|
+
matches:
|
|
137
|
+
- 'import\s+(?:type\s+)?\{[^}]*(?<![\w$])(?:Timestamptz|Timestamp|Time|Interval)(?![\w$])[^}]*\}\s*from\s*[\x27"]@prisma/orm-postgres/(?:contract-builder|target/codec-types)[\x27"]'
|
|
138
|
+
- id: temporal-types-from-temporal-spec
|
|
139
|
+
summary: |
|
|
140
|
+
Temporal fields are now typed with the `Temporal` types of the `temporal-spec` package rather than a global `Temporal` declaration, so they are typed even in a project without the polyfill's global types. The values are the same and assign to and from the global types. An extension's type test that requires a field to be exactly `Temporal.Instant` (or another `Temporal` type) from the global declarations now fails: add `temporal-spec` (`1.0.1`) to your development dependencies and import the type with `import type { Temporal } from 'temporal-spec'` in that test.
|
|
141
|
+
detection:
|
|
142
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
143
|
+
matches:
|
|
144
|
+
- '(?<![\s\S])(?![\s\S]*import\s+(?:type\s+)?\{[^}]*(?<![\w$])Temporal(?![\w$])(?!\s+as(?![\w$]))[^}]*\}\s*from\s*[\x27"]temporal-spec[\x27"])[\s\S]*toEqualTypeOf<\s*Temporal\.'
|
|
145
|
+
- id: contract-types-list-new-aggregates
|
|
146
|
+
summary: |
|
|
147
|
+
Optional. An emitted `contract.d.ts` lists the aggregates of every codec in the stack, so `prisma contract emit` now adds rows for the three new codecs to it, and the contract itself does not change. An extension that commits an emitted `contract.d.ts` re-emits it when it next changes the contract; until then the existing `contract.d.ts` keeps working. A migration snapshot's `contract.d.ts` does not need the new rows; it needs only the import change `branded-time-types-removed` describes.
|
|
148
|
+
- id: driver-ensures-target-session-settings
|
|
149
|
+
summary: |
|
|
150
|
+
A target descriptor may declare `sessionSettings`, the settings its codecs need on every database session; the PostgreSQL target declares `DateStyle=ISO`. A stack passes them to each driver it creates: a runtime driver descriptor's `create(options, sessionSettings)` receives them as a second argument, and a control driver's connect options carry them as `sessionSettings`. A driver for a target that declares them must ensure them on every connection it hands out. A wrapper around a driver descriptor's `create` passes `sessionSettings` on.
|
|
151
|
+
detection:
|
|
152
|
+
glob: "**/*.{ts,tsx,mts,cts}"
|
|
153
|
+
matches:
|
|
154
|
+
- '(?<![\w$])(?:RuntimeDriverDescriptor|ControlDriverDescriptor)(?![\w$])'
|
|
155
|
+
- id: authoring-field-namespace-removed
|
|
156
|
+
summary: |
|
|
157
|
+
A component's `authoring.field` namespace and the `fieldPreset` descriptor kind are removed. A component whose `authoring` still has a `field` key is refused with `CONTRACT.PACK_CONTRIBUTION_INVALID` when the stack is assembled. Contribute a type alias (`kind: 'typeAlias'`) or a type constructor in `authoring.type` instead. The detection matches files that declare a field preset or read or set `authoring.field`.
|
|
158
|
+
detection:
|
|
159
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
160
|
+
matches:
|
|
161
|
+
- 'kind:\s*[\x27"]fieldPreset[\x27"]'
|
|
162
|
+
- '(?<![\w$])authoring\??\.field(?![\w$])'
|
|
163
|
+
- '(?<![\w$.])field\s*:\s*\w*[Ff]ieldPresets(?![\w$])'
|
|
164
|
+
- id: argument-kinds-removed
|
|
165
|
+
summary: |
|
|
166
|
+
An authoring argument has one kind, `value`. The `number`, `object` and `option` argument kinds, the `select` template node, and the `path` and `default` of an `arg` template reference are removed, with the types `AuthoringOption`, `AuthoringValueArgument` and `AuthoringSelectRef`. Write each argument as `{ kind: 'value', dataType }` and use `AuthoringArgumentDescriptor` where you used `AuthoringValueArgument`. The detection matches authoring code that uses one of the removed kinds or types.
|
|
167
|
+
detection:
|
|
168
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
169
|
+
matches:
|
|
170
|
+
- '(?<![\s\S])(?=[\s\S]*\b[Aa]uthoring)[\s\S]*kind:\s*[\x27"](?:option|number|object|select)[\x27"]'
|
|
171
|
+
- '(?<![\w$])Authoring(?:Option|ValueArgument|SelectRef)(?![\w$])'
|
|
172
|
+
- '(?<![\w$])isAuthoringSelectRef(?![\w$])'
|
|
173
|
+
- id: preset-builders-removed
|
|
174
|
+
summary: |
|
|
175
|
+
The helpers that built and read field presets are removed: `instantiateAuthoringFieldPreset`, `isAuthoringFieldPresetDescriptor`, `getAuthoringFieldPreset`, `fieldPresetSpellings`, `instantiatePslFieldPreset`, `reportPresetNotCalled`, `temporalAuthoringPresets`, `temporalCodecPreset`, `temporalCodecPresetWithPrecision`, `temporalStringAuthoringPresets`, `temporalPhaseTemplate`, `temporalPhaseTemplateWithParams`, `TEMPORAL_ON_CREATE_ARG`, `TEMPORAL_ON_UPDATE_ARG`, `createFieldHelpersFromNamespace`, the types `PresetStorageTemplate`, `AuthoringFieldPresetDescriptor`, `AuthoringFieldPresetOutput`, `AuthoringFieldNamespace`, `AuthoringColumnDefaultTemplate`, `ObjectArgumentType`, `OptionalObjectArgumentKeys` and `GeneratedColumnSpec`, and the spec helpers `uuidv4`, `uuidv7`, `ulid`, `nanoid`, `cuid2` and `ksuid` of `@prisma/orm-framework/ids`. `assertNoCrossRegistryCollisions` no longer takes a field namespace. The detection matches files that use one of them.
|
|
176
|
+
detection:
|
|
177
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
178
|
+
matches:
|
|
179
|
+
- '(?<![\w$])(?:instantiateAuthoringFieldPreset|isAuthoringFieldPresetDescriptor|getAuthoringFieldPreset|fieldPresetSpellings|instantiatePslFieldPreset|reportPresetNotCalled|temporalAuthoringPresets|temporalCodecPreset|temporalCodecPresetWithPrecision|temporalStringAuthoringPresets|temporalPhaseTemplate|temporalPhaseTemplateWithParams|TEMPORAL_ON_CREATE_ARG|TEMPORAL_ON_UPDATE_ARG|createFieldHelpersFromNamespace|PresetStorageTemplate|AuthoringFieldPresetDescriptor|AuthoringFieldPresetOutput|AuthoringFieldNamespace|AuthoringColumnDefaultTemplate|ObjectArgumentType|OptionalObjectArgumentKeys|GeneratedColumnSpec)(?![\w$])'
|
|
180
|
+
- 'import\s*(?:type\s*)?\{[^}]*(?<![\w$])(?:uuidv4|uuidv7|ulid|nanoid|cuid2|ksuid)(?![\w$])[^}]*\}\s*from\s*[\x27"]@prisma/orm-framework/ids[\x27"]'
|
|
181
|
+
- '(?<![\w$])assertNoCrossRegistryCollisions\('
|
|
182
|
+
- id: preset-diagnostics-removed
|
|
183
|
+
summary: |
|
|
184
|
+
The PSL diagnostics `PSL_PRESET_NOT_CALLED`, `PSL_PRESET_NOT_LIST`, `PSL_PRESET_NOT_OPTIONAL`, `PSL_PRESET_AND_ID_CONFLICT`, `PSL_PRESET_AND_DEFAULT_CONFLICT` and `PSL_PRESET_WITHOUT_EFFECT` are removed, and MongoDB's `PSL_PRESET_ON_VARIANT_FIELD` and `PSL_PRESET_CONFLICT` are renamed `PSL_GENERATOR_ON_VARIANT_FIELD` and `PSL_GENERATOR_CONFLICT`. A preset call is now reported as `PSL_UNRESOLVED_REFERENCE`. The detection matches files that name a `PSL_PRESET_` code.
|
|
185
|
+
detection:
|
|
186
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
187
|
+
matches:
|
|
188
|
+
- 'PSL_PRESET_'
|
|
189
|
+
- id: field-presets-in-extension-code
|
|
190
|
+
summary: |
|
|
191
|
+
Code and documentation in an extension that calls a field preset, such as `field.id.uuidv4String()` in a test contract, a README or a message, uses the replacement of the app guide's tables: `field.column(type.UuidString()).id().onCreate(gen.uuid())`. A package that exports `field` and `gen` built by `createComposedAuthoringHelpers` for use outside a contract also exports `type` from the same call. The detection matches files that call a preset.
|
|
192
|
+
detection:
|
|
193
|
+
glob: "**/*.{ts,mts,cts,tsx,md}"
|
|
194
|
+
matches:
|
|
195
|
+
- '(?<![\w$.])field\.(?:id|temporal)\.'
|
|
196
|
+
- '(?<![\w$.])field\.(?:text|int|bigint|float|decimal|boolean|bytes|dateTime|uuidString|uuidNative|ulid|nanoid|cuid2|ksuid|generated)\('
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
# 8.0.0-rc.20 → 8.0.0-rc.21 — Extension author upgrade instructions
|
|
200
|
+
|
|
201
|
+
No change in this release comes with a script. Make the changes below in any order.
|
|
202
|
+
|
|
203
|
+
## A client reports failures through what its members return
|
|
204
|
+
|
|
205
|
+
### `client-members-reject-instead-of-throwing`
|
|
206
|
+
|
|
207
|
+
A member that returns a promise or a result now reports a closed client, a failed connection or an ended transaction through what it returns. Code that relied on the call itself throwing must await the result or attach `.catch(...)`:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
await db.close();
|
|
211
|
+
|
|
212
|
+
// Before: throws at the call, so .catch never runs
|
|
213
|
+
db.query(plan).toArray().catch(handle);
|
|
214
|
+
|
|
215
|
+
// After: the result rejects, so handle runs
|
|
216
|
+
db.query(plan).toArray().catch(handle);
|
|
217
|
+
|
|
218
|
+
// A synchronous try/catch around an unawaited call stops catching
|
|
219
|
+
try {
|
|
220
|
+
db.transaction(work);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
handle(error);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Await it instead
|
|
226
|
+
try {
|
|
227
|
+
await db.transaction(work);
|
|
228
|
+
} catch (error) {
|
|
229
|
+
handle(error);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
For each file the detection matches, check each `try` block it names. Leave a call whose result is awaited or returned to an awaiting caller as it is.
|
|
234
|
+
|
|
235
|
+
### `lazy-activity-source-rejects`
|
|
236
|
+
|
|
237
|
+
No code change is needed unless your code caught errors from `lazyActivitySource`, `delegatingActivitySource` or a `withTransaction` context with a synchronous `try`/`catch`. Await the call inside the `try` block instead.
|
|
238
|
+
|
|
239
|
+
## A control adapter names where it keeps its markers
|
|
240
|
+
|
|
241
|
+
### `control-adapter-marker-location`
|
|
242
|
+
|
|
243
|
+
Add `markerLocation` to your control adapter, so messages about the contract markers name the right table or collection:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
// Before
|
|
247
|
+
export class MyControlAdapter implements SqlControlAdapter<'my-target'> {
|
|
248
|
+
readonly familyId = 'sql' as const;
|
|
249
|
+
readonly targetId = 'my-target' as const;
|
|
250
|
+
…
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// After
|
|
254
|
+
export class MyControlAdapter implements SqlControlAdapter<'my-target'> {
|
|
255
|
+
readonly familyId = 'sql' as const;
|
|
256
|
+
readonly targetId = 'my-target' as const;
|
|
257
|
+
readonly markerLocation = 'my_schema.marker';
|
|
258
|
+
…
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The same applies to an adapter written as an object literal or returned by a factory: add `markerLocation: 'my_schema.marker'` to the object.
|
|
263
|
+
|
|
264
|
+
A family that implements `ControlFamilyInstance` itself adds `markerLocation` too, usually read from its control adapter:
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
return {
|
|
268
|
+
familyId: 'my-family',
|
|
269
|
+
get markerLocation() {
|
|
270
|
+
return getControlAdapter().markerLocation;
|
|
271
|
+
},
|
|
272
|
+
…
|
|
273
|
+
};
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
A test double that builds a control adapter or a `ControlFamilyInstance` sets it too.
|
|
277
|
+
|
|
278
|
+
### `control-adapter-hold-marker-lock`
|
|
279
|
+
|
|
280
|
+
If your database commits a transaction when it runs DDL, as MySQL does, give your SQL control adapter `holdMarkerLock(driver, work)`: take the marker lock, run `work`, and release the lock when `work` ends. `db sign` then creates the marker table inside `work`, under the lock, and writes the markers in a transaction after it. A target whose DDL is transactional needs nothing: without `holdMarkerLock`, `db sign` keeps the lock, the marker table and the writes in one transaction.
|
|
281
|
+
|
|
282
|
+
### `verify-contract-spaces-marker-location`
|
|
283
|
+
|
|
284
|
+
A call to `verifyContractSpaces` (from `@prisma/orm-toolchain/migration-tools/spaces`) passes the marker location of the target it verifies, such as `markerLocation: 'prisma_contract.marker'` for Postgres or `'_prisma_marker'` for SQLite.
|
|
285
|
+
|
|
286
|
+
## A SQL operation's schema is optional
|
|
287
|
+
|
|
288
|
+
### `plan-target-details-schema-optional`
|
|
289
|
+
|
|
290
|
+
Code that reads `target.details.schema` from a SQL migration operation treats it as `string | undefined`: SQLite and MySQL operations name no schema.
|
|
291
|
+
|
|
292
|
+
## Statements and subjects can name an enum value
|
|
293
|
+
|
|
294
|
+
### `enum-value-rename-statement`
|
|
295
|
+
|
|
296
|
+
`--rename Status.ARCHIVED:Status.RETIRED` resolves to a rename statement with `entity: 'enumValue'`, and a data-loss subject can be `{ kind: 'enumValue', namespaceId, enum, member }`, named by the member's name in the contract source. A `switch` or `if` over `statement.entity` or `subject.kind` gains an `'enumValue'` branch. A planner that does not plan enum value renames refuses the statement with a `statementRefused` conflict, as it refuses a namespace rename it cannot plan.
|
|
297
|
+
|
|
298
|
+
### `rows-holding-value-and-keep-data-edit`
|
|
299
|
+
|
|
300
|
+
A target that plans the removal of a stored value can tell the user how to keep the data it would lose. Nothing is required: `rowsHoldingValue`, `keepDataEdit` and `leaveOut` are all optional.
|
|
301
|
+
|
|
302
|
+
- In the runner, when the check before a removal fails because rows still hold the value, count them and set `meta.rowsHoldingValue` on the failure: `enumValue` is the enum value in its JSON form, `{ namespaceId?, enum, member }`, with `namespaceId` left out for the unbound namespace; `value` is the stored value as the database stores it; `rows` is the count; `operationIndex` is the position of the failed operation in its plan; and `keepDataEdit`, when the target can say it, is the edit below. If the count fails, return the plain check failure without the field.
|
|
303
|
+
- In the planner, set `keepDataEdit` on a `MigrationDataLoss` entry when an edit to the `migration.ts` the plan writes keeps the data: `remove` is the call as the file writes it, and `replaceWith` is the text that replaces it, which may be several calls separated by `, `. Set `swapsValues: true` when the edit moves values between members that trade them, so the CLI offers no way that renames them in a cycle. The CLI prints the edit beside the question, and leads its next actions with it.
|
|
304
|
+
- In the planner, when a refused statement's change can be written by hand, set `leaveOut` on the conflict to the statements to leave out. The CLI then prints the plan without them as the next action, and the conflict's `why` says what to add to its `migration.ts`.
|
|
305
|
+
|
|
306
|
+
## Contract source warnings reach the caller
|
|
307
|
+
|
|
308
|
+
### `contract-source-warnings`
|
|
309
|
+
|
|
310
|
+
This change applies to every family. The detection matches every call to `loadContractSource`.
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
// Before
|
|
314
|
+
const result = await loadContractSource(config, { onWarning: (warning) => warnings.push(warning) });
|
|
315
|
+
if (result.ok) use(result.value);
|
|
316
|
+
|
|
317
|
+
// After
|
|
318
|
+
const result = await loadContractSource(config);
|
|
319
|
+
const { warnings } = result.ok ? result.value : result.failure;
|
|
320
|
+
if (result.ok) use(result.value.contract);
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## MongoDB contract sources share one builder
|
|
324
|
+
|
|
325
|
+
Every MongoDB contract source, `defineContract`, Prisma 8 PSL and the Prisma 6 reader, now builds through one builder, so each MongoDB rule applies to every source in the same way. The builder records the stack's target and extension packs. Two MongoDB type names change to match SQL's, and the sections after them list where a source now refuses or accepts what it did not before. A contract that every source accepted before builds to the same `contract.json`.
|
|
326
|
+
|
|
327
|
+
### `mongo-contract-target-option`
|
|
328
|
+
|
|
329
|
+
Pass the MongoDB target pack as `target`:
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
import { mongoContract } from '@prisma/orm-family-mongo/contract-psl/provider';
|
|
333
|
+
import mongoTargetPack from '@prisma/orm-target-mongo/target/pack';
|
|
334
|
+
|
|
335
|
+
const contract = mongoContract('./prisma/schema.prisma', { target: mongoTargetPack });
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Keep any other options you pass, such as `output`, in the same object. A config that names its contract through `defineConfig({ contract: './prisma/schema.prisma' })` from `@prisma/orm-mongo/config` already passes the pack. A call without `target` is refused with `CONTRACT.ARGUMENT_INVALID` (`reason: 'target-pack-missing'`).
|
|
339
|
+
|
|
340
|
+
### `mongo-contract-input`
|
|
341
|
+
|
|
342
|
+
The type of the object you pass to `defineContract` is now `ContractInput`, as it is in SQL. Rename the import and each use:
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
import type { ContractInput } from '@prisma/orm-family-mongo/contract-ts/contract-builder';
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### `mongo-model-definition-removed`
|
|
349
|
+
|
|
350
|
+
`MongoModelDefinition` was an alias for a model of a built contract. SQL has no such alias. Write the type it stood for:
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
import type { ContractModel } from '@prisma/orm-framework/contract/types';
|
|
354
|
+
import type { MongoModelStorage } from '@prisma/orm-family-mongo/contract';
|
|
355
|
+
|
|
356
|
+
function collectionOf(model: ContractModel<MongoModelStorage>): string | undefined {
|
|
357
|
+
return model.storage.collection;
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### `mongo-ts-polymorphism-rules`
|
|
362
|
+
|
|
363
|
+
The detection matches a file that imports the MongoDB contract builder and declares a discriminator; an emitted `contract.d.ts` imports no builder, so it is not matched.
|
|
364
|
+
|
|
365
|
+
A discriminator must be a required text field, and each variant must be declared and stored in its base's collection:
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
const Task = model('Task', {
|
|
369
|
+
collection: 'tasks',
|
|
370
|
+
fields: { _id: field.objectId(), type: field.string() },
|
|
371
|
+
discriminator: { field: 'type', variants: { Bug: { value: 'bug' } } },
|
|
372
|
+
});
|
|
373
|
+
const Bug = model('Bug', { base: Task, fields: { severity: field.int32() } });
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### `mongo-index-shape-rules`
|
|
377
|
+
|
|
378
|
+
MongoDB refuses these indexes when it creates them, so the contract now refuses them first. A matched file uses a wildcard, a hashed key, a wildcard projection or a collation; check each such index against the list in the summary.
|
|
379
|
+
|
|
380
|
+
### `mongo-value-object-enum-check`
|
|
381
|
+
|
|
382
|
+
Declare every enum a value object field uses in `defineContract({ enums })`.
|
|
383
|
+
|
|
384
|
+
### `mongo-newly-accepted`
|
|
385
|
+
|
|
386
|
+
Nothing to change.
|
|
387
|
+
|
|
388
|
+
### `mongo-prisma6-merged-indexes`
|
|
389
|
+
|
|
390
|
+
Emit the contract again and sign the database, so `db verify` compares against the new storage hash.
|
|
391
|
+
|
|
392
|
+
## Explicit date and time types carry the kind of value they read
|
|
393
|
+
|
|
394
|
+
On PostgreSQL, a column type that several codecs read now names the kind of value in its name. The `Temporal` types gain the suffix `Temporal`, and the interval type that reads `{ months, days, micros }` gains the suffix `Parts`:
|
|
395
|
+
|
|
396
|
+
| Before | After | Reads |
|
|
397
|
+
| --- | --- | --- |
|
|
398
|
+
| `Timestamptz(p?)` | `TimestamptzTemporal(p?)` | `Temporal.Instant` |
|
|
399
|
+
| `Timestamp(p?)` | `TimestampTemporal(p?)` | `Temporal.PlainDateTime` |
|
|
400
|
+
| `Interval(p?)` | `IntervalParts(p?)` | `{ months, days, micros }` |
|
|
401
|
+
|
|
402
|
+
This change leaves `DateTime`, `Date` and `Time` as they are, and adds `DateTemporal` and `TimeTemporal` as the explicit names of what `Date` and `Time` read today. A later release gives `DateTime`, `Date` and `Time` new meanings, as convenience date and time types, and brings its own instructions. To keep what a field reads today through that change, you can already write the explicit name: `TimestamptzTemporal` for `DateTime`, `DateTemporal` for `Date` and `TimeTemporal` for `Time`.
|
|
403
|
+
|
|
404
|
+
Three explicit types are new, and need no change to existing schemas: `TimestampJsDate(p?)`, a `timestamp` column read as a JavaScript `Date`; `TimestampInstant(p?)`, a `timestamp` column read as a `Temporal.Instant`; and `IntervalString(p?)`, an `interval` column read as an ISO 8601 duration such as `P1Y2M`. Both timestamp types read and write the stored date and time as UTC.
|
|
405
|
+
|
|
406
|
+
### `psl-temporal-type-renames`
|
|
407
|
+
|
|
408
|
+
Rename each field type in your extension's `.prisma` contract source using the table above, keeping its arguments and its attributes:
|
|
409
|
+
|
|
410
|
+
```prisma
|
|
411
|
+
model Event {
|
|
412
|
+
id Int @id
|
|
413
|
+
at TimestamptzTemporal(3) // was Timestamptz(3)
|
|
414
|
+
local TimestampTemporal // was Timestamp
|
|
415
|
+
span IntervalParts // was Interval
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
A type alias written with one of the names, such as `types { Stamp = Timestamp(3) }`, is renamed the same way. The detection can match one of the words in a comment or a model name; rename only a field type or an alias's type.
|
|
420
|
+
|
|
421
|
+
### `ts-temporal-type-helpers-renamed`
|
|
422
|
+
|
|
423
|
+
```ts
|
|
424
|
+
field.column(type.TimestamptzTemporal(3)); // was type.Timestamptz(3)
|
|
425
|
+
field.column(intervalPartsColumn(6)); // was intervalColumn(6)
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### `interval-with-precision-typed-as-parts`
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
import type { PgInterval } from '@prisma/orm-postgres/target/codec-types';
|
|
432
|
+
|
|
433
|
+
const span: PgInterval = row.span; // an IntervalParts(6) column
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### `branded-time-types-removed`
|
|
437
|
+
|
|
438
|
+
Remove the four names from the import, and leave the rest of the file as it is:
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
import type {
|
|
442
|
+
CodecTypes as PgTypes,
|
|
443
|
+
JsonValue,
|
|
444
|
+
} from '@prisma/orm-postgres/target/codec-types'; // was also importing Interval, Time, Timestamp and Timestamptz
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### `temporal-types-from-temporal-spec`
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
import type { Temporal } from 'temporal-spec';
|
|
451
|
+
|
|
452
|
+
expectTypeOf<Row['createdAt']>().toEqualTypeOf<Temporal.Instant>();
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
If the test file also creates `Temporal` values, import the type under another name, such as `import type { Temporal as TemporalTypes } from 'temporal-spec'`, so the runtime `Temporal` stays in scope.
|
|
456
|
+
|
|
457
|
+
### `contract-types-list-new-aggregates`
|
|
458
|
+
|
|
459
|
+
No change is needed now. The next `prisma contract emit` adds rows for the three new codecs to `contract.d.ts`.
|
|
460
|
+
|
|
461
|
+
## A driver ensures the session settings its target declares
|
|
462
|
+
|
|
463
|
+
### `driver-ensures-target-session-settings`
|
|
464
|
+
|
|
465
|
+
A target can now state the settings every database session needs, as data on its descriptor:
|
|
466
|
+
|
|
467
|
+
```ts
|
|
468
|
+
const target = { ...meta, sessionSettings: { DateStyle: 'ISO' } };
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
`createExecutionStack` and `createControlStack` pass them to the driver. A runtime driver descriptor receives them as the second argument of `create`, after its own options; a control driver receives them in its connect options:
|
|
472
|
+
|
|
473
|
+
```ts
|
|
474
|
+
create(options?: MyDriverOptions, sessionSettings?: SessionSettings): MyDriver
|
|
475
|
+
create(url: string, options?: ControlDriverConnectOptions): Promise<MyControlDriver> // options.sessionSettings
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
A driver for a target that declares settings applies them to every connection it hands out, before the first statement, and again whenever a connection's session may have been reset. A driver for a target that declares none needs no change. Code that wraps a driver descriptor to curry its options passes the second argument on, or the driver never receives the settings:
|
|
479
|
+
|
|
480
|
+
```ts
|
|
481
|
+
const driverWithCursor = {
|
|
482
|
+
...postgresDriverDescriptor,
|
|
483
|
+
create(_options, sessionSettings) {
|
|
484
|
+
return postgresDriverDescriptor.create({ cursor }, sessionSettings);
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
A codec whose application value is the stored form of its data type builds its values with the new `CodecImpl.storedDataTypeValueOf`, which takes only the stored spelling, instead of `dataTypeValueOf`.
|
|
490
|
+
|
|
491
|
+
## Field presets are removed
|
|
492
|
+
|
|
493
|
+
This section replaces two pieces of advice from the 8.0.0-rc.19 upgrade guide. That guide said that a field preset keeps its `number`, `option` and `object` arguments, and showed field presets built with `instantiatePslFieldPreset` and `temporalCodecPresetWithPrecision`. Neither holds any more: this release removes field presets, the `authoring.field` namespace and every argument kind except `value`.
|
|
494
|
+
|
|
495
|
+
A pack now contributes what a schema writes in a field's type position only through `authoring.type`: a type constructor, such as `Char(36)`, or a type alias, such as `temporal.CreatedAt`. Generated values and the identity are written by the user as attributes (`@id`, `@onCreate(...)`, `@onUpdate(...)` in PSL; `.id()`, `.onCreate(gen.fn())`, `.onUpdate(gen.fn())` in TypeScript), or set by a type alias. The upgrade guide for apps lists the replacement of every preset Prisma contributed.
|
|
496
|
+
|
|
497
|
+
### `authoring-field-namespace-removed`
|
|
498
|
+
|
|
499
|
+
Move each field preset out of `authoring.field`. A preset that stored a column with fixed type parameters and generated values becomes a type alias in `authoring.type`, as the targets' `temporal.CreatedAt` is:
|
|
500
|
+
|
|
501
|
+
```ts
|
|
502
|
+
// Before
|
|
503
|
+
authoring: {
|
|
504
|
+
field: {
|
|
505
|
+
temporal: {
|
|
506
|
+
createdAt: {
|
|
507
|
+
kind: 'fieldPreset',
|
|
508
|
+
output: {
|
|
509
|
+
codecId: 'pg/timestamptz-temporal@1',
|
|
510
|
+
executionDefaults: { onCreate: { kind: 'generator', id: 'instantNow' } },
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
|
|
517
|
+
// After
|
|
518
|
+
authoring: {
|
|
519
|
+
type: {
|
|
520
|
+
temporal: {
|
|
521
|
+
CreatedAt: {
|
|
522
|
+
kind: 'typeAlias',
|
|
523
|
+
documentation: 'A timestamp the client sets to now when a row is created.',
|
|
524
|
+
output: {
|
|
525
|
+
type: { codecId: 'pg/timestamptz-temporal@1' },
|
|
526
|
+
onCreate: { name: 'now', args: {} },
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
`temporalTypeAliases(type, value)` from `@prisma/orm-framework/components/authoring` builds the `CreatedAt` and `UpdatedAt` pair for a timestamp type. A type alias calls a generator function by name, as `@onCreate(now())` does, and the stack's bindings pick the generator for the alias's codec. A preset that took arguments becomes a type constructor in `authoring.type`, and the user writes the generated values and `@id` as attributes. A preset whose only job was `@id` plus a generator, such as `id.uuidv4String()`, has no replacement in the pack: the user writes the SQL family's identifier alias with the attributes, `UuidString @id @onCreate(uuid())`.
|
|
535
|
+
|
|
536
|
+
Remove the `field` key from `authoring` on both the pack ref and the control descriptor. Then assemble the stack: if any `field` key is left, the control stack and the TypeScript builders throw `CONTRACT.PACK_CONTRIBUTION_INVALID` with `Component "<id>" contributes authoring.field, which Prisma 8 removed with field presets. Contribute a type alias (kind: 'typeAlias') or a type constructor in authoring.type.`
|
|
537
|
+
|
|
538
|
+
### `argument-kinds-removed`
|
|
539
|
+
|
|
540
|
+
`AuthoringArgumentDescriptor` is now `{ kind: 'value'; dataType: string; name?: string; optional?: boolean }`. A type constructor already took only `value` arguments; the other kinds were left only for field presets. Replace `AuthoringValueArgument` with `AuthoringArgumentDescriptor`, and delete code that builds or reads `option`, `number`, `object` or `select` descriptors and templates, and the `path` and `default` of a `{ kind: 'arg' }` template reference. A template refers to a whole argument by its index: `{ kind: 'arg', index: 0 }`.
|
|
541
|
+
|
|
542
|
+
### `preset-builders-removed`
|
|
543
|
+
|
|
544
|
+
Delete each use of the removed helpers and types with the preset it built or read. `temporalTypeAliases`, `TIMESTAMP_NOW_GENERATOR_ID` and `timestampNowControlDescriptor` stay. `generatedLength` stays in `@prisma/orm-framework/ids`; the spec helpers `uuidv4()` and the others fed only `field.generated(...)`, which is removed too.
|
|
545
|
+
|
|
546
|
+
`assertNoCrossRegistryCollisions` takes the type namespace, then the entity type, PSL block and model attribute namespaces. Remove the field namespace argument you passed second:
|
|
547
|
+
|
|
548
|
+
```ts
|
|
549
|
+
// Before
|
|
550
|
+
assertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityTypeNamespace);
|
|
551
|
+
|
|
552
|
+
// After
|
|
553
|
+
assertNoCrossRegistryCollisions(typeNamespace, entityTypeNamespace);
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### `preset-diagnostics-removed`
|
|
557
|
+
|
|
558
|
+
Code that matches a diagnostic by code: a preset call is now `PSL_UNRESOLVED_REFERENCE`, with the message `<call> was a field preset, and Prisma 8 removed field presets. Write <replacement>.` The other `PSL_PRESET_*` codes cannot occur, so remove the code that handles them. Rename `PSL_PRESET_ON_VARIANT_FIELD` to `PSL_GENERATOR_ON_VARIANT_FIELD` and `PSL_PRESET_CONFLICT` to `PSL_GENERATOR_CONFLICT`. Their messages now start `Generated value on`, and they are reported for `@onCreate(...)`, `@onUpdate(...)` and type aliases that generate a value.
|
|
559
|
+
|
|
560
|
+
### `field-presets-in-extension-code`
|
|
561
|
+
|
|
562
|
+
Rewrite every preset call in the extension's code, test contracts, messages, doc comments and documentation with the tables of the app upgrade guide. In a `defineContract` callback, take `gen` and `type` from the callback's argument where the rewritten fields use them, adding each missing name at the end of the destructuring, `gen` before `type`. A preset named in a message or doc comment as an example, such as `field.text()` or `field.temporal.timestamptz()`, becomes its replacement, such as `field.column(type.String())` or `field.column(type.TimestamptzTemporal())`. A sentence that describes the presets themselves, such as one saying a `field` export has the same presets as the callback, says instead that the export gives the same `field` and `type` as the callback. If a callback renames `field`, as in `({ field: f })`, the detection does not see `f.id.uuidv4String()`; search for it yourself.
|
|
563
|
+
|
|
564
|
+
If your package exports `field` and `gen` from a `createComposedAuthoringHelpers(...)` call so that code outside a contract, such as a query fragment, can declare fields, export that call's `type` too, with a doc comment that names an example such as `type.TimestamptzTemporal()`:
|
|
565
|
+
|
|
566
|
+
```ts
|
|
567
|
+
export const type: Helpers['type'] = helpers.type;
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
Add it wherever the package re-exports `field` and `gen`, and replace the preset examples in the doc comment of `field` with `field.column(type.X())` examples. The app upgrade guide's section `ts-field-presets-removed` covers the rest of a `defineContract` callback: a name `type` that is already bound, code that does not know its target, and a `field` imported outside a callback.
|