@prisma/orm-mysql 0.0.0-stage → 8.0.0-rc.21-dev.23
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-Dv4HuJDi-CoURZL0Y.mjs +83 -0
- package/dist/mysql-static-Dv4HuJDi-CoURZL0Y.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
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "0.11"
|
|
3
|
+
to: "0.12"
|
|
4
|
+
changes:
|
|
5
|
+
- id: replace-verify-with-verify-marker
|
|
6
|
+
summary: |
|
|
7
|
+
The SQL runtime's `verify: { mode; requireMarker }` option is removed; replaced by `verifyMarker?: 'onFirstUse' | false` (default `'onFirstUse'`). The runtime no longer throws on contract-marker drift — instead it emits a structured `warn`-level log line once per runtime instance and proceeds with the query. Callers that previously caught `CONTRACT.MARKER_MISMATCH` to detect deploy-skew migrate to log scraping (filter on `code: 'CONTRACT.MARKER_MISMATCH'` / `code: 'CONTRACT.MARKER_MISSING'` from the runtime's `Log.warn` sink) or invoke the explicit `db-verify` CLI for fail-fast verification.
|
|
8
|
+
detection:
|
|
9
|
+
glob: "**/*.{ts,tsx}"
|
|
10
|
+
contains:
|
|
11
|
+
- "verify:"
|
|
12
|
+
- "requireMarker"
|
|
13
|
+
anyMatch: false
|
|
14
|
+
- id: remove-capabilities-from-define-contract
|
|
15
|
+
summary: |
|
|
16
|
+
The `capabilities` field on the first argument of `defineContract({...}, ...)` is removed. Capabilities are now contributed automatically by extension packs and target components; declaring them by hand is no longer accepted and the contract builder will refuse the literal. Delete the `capabilities: { ... }` block from every `defineContract` call site, then re-emit your contract artefacts (`pnpm emit`, which runs `prisma-next contract emit`) to refresh `contract.json` / `contract.d.ts`. The regenerated artefacts pick up the contributor-declared capabilities — including two new ones in the 0.12 line, `postgres.distinctOn` and `sql.lateral`, which extensions contribute on your behalf when their pack is in `extensionPacks`.
|
|
17
|
+
detection:
|
|
18
|
+
glob: "**/*.{ts,tsx}"
|
|
19
|
+
contains:
|
|
20
|
+
- "defineContract"
|
|
21
|
+
- "capabilities:"
|
|
22
|
+
anyMatch: false
|
|
23
|
+
- id: strip-migration-labels-hints
|
|
24
|
+
summary: |
|
|
25
|
+
The 0.12 migration manifest schema is closed (`'+': 'reject'`) and the metadata model no longer carries `labels` or `hints`; any on-disk `migration.json` still holding either key fails to load with `INVALID_MANIFEST` naming the offending key. Both fields are also dropped from the content-addressed migration identity, so `migrationHash` is now computed over `{ from, to, providedInvariants, createdAt }` plus the sibling `ops.json`. Run the colocated codemod to strip both keys from every `migration.json` and recompute its `migrationHash` over the slimmed envelope.
|
|
26
|
+
detection:
|
|
27
|
+
glob: "**/migration.json"
|
|
28
|
+
contains:
|
|
29
|
+
- '"labels"'
|
|
30
|
+
- '"hints"'
|
|
31
|
+
anyMatch: true
|
|
32
|
+
script: ./strip-migration-labels-hints.ts
|
|
33
|
+
- id: re-emit-closed-mongo-contracts
|
|
34
|
+
summary: |
|
|
35
|
+
Re-emit Mongo contract artefacts so emitted `$jsonSchema` validators are closed (`additionalProperties: false` at every level, including polymorphic `oneOf` branches). Each non-variant Mongo model must resolve to an `objectId` `_id` before emit succeeds — otherwise interpret fails with `PSL_MONGO_ID_REQUIRED`. After re-emitting, apply the open→closed validator migration with `prisma-next db update -y`; the planner classifies the tightening as `destructive` and refuses without confirmation.
|
|
36
|
+
detection:
|
|
37
|
+
glob: "**/contract.json"
|
|
38
|
+
contains:
|
|
39
|
+
- '"kind": "mongo-database"'
|
|
40
|
+
anyMatch: true
|
|
41
|
+
script: ./re-emit-closed-mongo-contracts.ts
|
|
42
|
+
- id: public-default-namespace
|
|
43
|
+
summary: |
|
|
44
|
+
Un-namespaced Postgres models now emit under the `public` namespace instead of the `__unbound__` sentinel; explicit `namespace unbound { … }` in PSL still round-trips to `__unbound__`. Re-emit contract artefacts (`pnpm emit`, i.e. `prisma-next contract emit`) so `contract.json` / `contract.d.ts` pick up the new storage/domain namespace key (`__unbound__`/`postgres-unbound-schema` → `public`/`postgres-schema`). No hand-editing of emitted JSON is required when the PSL/TS contract source is unchanged.
|
|
45
|
+
detection:
|
|
46
|
+
glob: "**/contract.json"
|
|
47
|
+
contains:
|
|
48
|
+
- '"kind": "postgres-unbound-schema"'
|
|
49
|
+
anyMatch: true
|
|
50
|
+
script: ./re-emit-postgres-public-default.ts
|
|
51
|
+
- id: domain-plane-namespaced-contract
|
|
52
|
+
summary: |
|
|
53
|
+
`contract.models` / `contract.valueObjects` moved under `contract.domain.namespaces.<ns>` (symmetric domain plane). Re-emit contract artefacts (`pnpm emit`) so emitted JSON and `contract.d.ts` carry the namespaced domain envelope; generated types switch from `Contract['models']` to `ContractModelsMap<Contract>`.
|
|
54
|
+
detection:
|
|
55
|
+
glob: "**/contract.d.ts"
|
|
56
|
+
contains:
|
|
57
|
+
- "Contract['models']"
|
|
58
|
+
anyMatch: true
|
|
59
|
+
script: ./re-emit-domain-namespaced-contracts.ts
|
|
60
|
+
- id: runtime-qualified-sql-default-namespace
|
|
61
|
+
summary: |
|
|
62
|
+
Postgres runtime SQL now emits namespace-qualified table identifiers (e.g. `"public"."user"`). Flat `db.sql.*` / `db.*` call sites are unchanged. Update integration or snapshot tests that assert raw SQL strings. Re-emit contract artefacts only if you are still catching up an earlier 0.12 namespacing transition.
|
|
63
|
+
detection:
|
|
64
|
+
glob: "**/*.{ts,tsx}"
|
|
65
|
+
contains:
|
|
66
|
+
- 'FROM "user"'
|
|
67
|
+
anyMatch: true
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
# 0.11 → 0.12 — User upgrade instructions
|
|
71
|
+
|
|
72
|
+
## `replace-verify-with-verify-marker`
|
|
73
|
+
|
|
74
|
+
Starting at the 0.12 release, the SQL runtime's marker-verification API is simplified. The previous `verify: { mode; requireMarker }` option carried two concerns — *when* to verify and *whether to throw on absent markers* — both of which leaked internal implementation detail into the public API. The new option is a single discriminated union: `verifyMarker?: 'onFirstUse' | false`, with `'onFirstUse'` as the default.
|
|
75
|
+
|
|
76
|
+
The runtime's response to contract-marker drift also changes. Previously the runtime threw `CONTRACT.MARKER_MISMATCH` (or `CONTRACT.MARKER_MISSING`) on every query when the database's contract hash didn't match the runtime's. From 0.12 onward, the runtime emits a structured `warn`-level log line **once per runtime instance** and proceeds with the query. The intent is to make rolling deploys safe by default: a drifted-but-running app surfaces the warning loudly without crashing every query for the duration of the deploy window.
|
|
77
|
+
|
|
78
|
+
### Migration
|
|
79
|
+
|
|
80
|
+
Walk every call site that constructs a SQL runtime via `createRuntime(...)` or the convenience wrappers (`sqlite(...)`, `postgres(...)`, `postgresServerless(...)`).
|
|
81
|
+
|
|
82
|
+
For each call site that passes `verify: {...}`:
|
|
83
|
+
|
|
84
|
+
- `verify: { mode: 'onFirstUse', requireMarker: false }` → `verifyMarker: 'onFirstUse'` (or simply omit the option — `'onFirstUse'` is the default).
|
|
85
|
+
- `verify: { mode: 'onFirstUse', requireMarker: true }` → `verifyMarker: 'onFirstUse'`. The `requireMarker: true` semantics (throw on absent marker) is removed; if you need fail-fast verification, use the `db-verify` CLI command at deploy time instead of relying on the runtime to crash.
|
|
86
|
+
- `verify: { mode: 'always', requireMarker: ... }` → `verifyMarker: 'onFirstUse'`. The `'always'` mode (re-verify on every query) is dropped; verification is now once-per-runtime regardless of mode. The CLI `db-verify` command remains the explicit-verification surface.
|
|
87
|
+
- `verify: { mode: 'startup', requireMarker: ... }` → `verifyMarker: 'onFirstUse'`. The `'startup'` mode is dropped for the same reason — without the throw-on-mismatch semantic, the `'startup'` vs `'onFirstUse'` distinction collapsed to "same behaviour, different timing." Verification fires lazily on the first `execute()` call.
|
|
88
|
+
- If you explicitly want to skip marker verification entirely (e.g. during a known-skewed deploy window where contract drift is expected and tolerated): `verifyMarker: false`.
|
|
89
|
+
|
|
90
|
+
### Before 0.12
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
const runtime = createRuntime({
|
|
94
|
+
stackInstance,
|
|
95
|
+
context,
|
|
96
|
+
driver,
|
|
97
|
+
verify: { mode: 'onFirstUse', requireMarker: false },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
for await (const row of runtime.execute(plan)) {
|
|
102
|
+
// ...
|
|
103
|
+
}
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if (err.code === 'CONTRACT.MARKER_MISMATCH') {
|
|
106
|
+
// deploy-skew detected — crash and let the orchestrator restart us
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Starting at 0.12
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const runtime = createRuntime({
|
|
117
|
+
stackInstance,
|
|
118
|
+
context,
|
|
119
|
+
driver,
|
|
120
|
+
log: {
|
|
121
|
+
info: console.info,
|
|
122
|
+
warn: (payload) => {
|
|
123
|
+
console.warn(payload);
|
|
124
|
+
if (
|
|
125
|
+
payload.code === 'CONTRACT.MARKER_MISMATCH' ||
|
|
126
|
+
payload.code === 'CONTRACT.MARKER_MISSING'
|
|
127
|
+
) {
|
|
128
|
+
// optional: forward to your observability surface
|
|
129
|
+
sendToTelemetry(payload);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
error: console.error,
|
|
133
|
+
},
|
|
134
|
+
// verifyMarker omitted — 'onFirstUse' is the default
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
for await (const row of runtime.execute(plan)) {
|
|
138
|
+
// ...
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The runtime now does not crash on drift — it emits one structured log line per runtime instance, then proceeds. Operators who want fail-fast verification at deploy time (rather than as a per-runtime diagnostic) should invoke the `db-verify` CLI as part of their deployment pipeline.
|
|
143
|
+
|
|
144
|
+
### Type-level change
|
|
145
|
+
|
|
146
|
+
The `RuntimeVerifyOptions` type is removed from `@internal/sql-runtime` exports; replaced by `VerifyMarkerOption = 'onFirstUse' | false`. Any consumer code that imports `RuntimeVerifyOptions` will fail to compile after the bump.
|
|
147
|
+
|
|
148
|
+
```diff
|
|
149
|
+
-import type { RuntimeVerifyOptions } from '@internal/sql-runtime';
|
|
150
|
+
+import type { VerifyMarkerOption } from '@internal/sql-runtime';
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Validation
|
|
154
|
+
|
|
155
|
+
After applying the rule above, run `pnpm typecheck && pnpm test` (or your application's equivalent). The change is mechanical: TypeScript flags every `verify: {...}` call site as a type error after the bump, and every `RuntimeVerifyOptions` import similarly. Once those errors are resolved, the behaviour change (warn-log instead of throw on drift) shows up only at runtime when a marker mismatch actually occurs.
|
|
156
|
+
|
|
157
|
+
## `remove-capabilities-from-define-contract`
|
|
158
|
+
|
|
159
|
+
Starting at the 0.12 release, the `capabilities` field on the first argument of `defineContract({...}, ...)` is removed. Capabilities are now contributed automatically by the target's components and the extension packs you load via `extensionPacks: { ... }`; the contract builder will refuse a literal `capabilities` key. Hand-declaring capabilities was redundant with — and frequently drifted from — the contributor-declared set, so the authoring surface drops the field outright.
|
|
160
|
+
|
|
161
|
+
Two consumer-visible consequences:
|
|
162
|
+
|
|
163
|
+
- **Source change**: delete the `capabilities: { ... }` block from every `defineContract` call site.
|
|
164
|
+
- **Emitted artefacts**: the regenerated `contract.json` / `contract.d.ts` will pick up the contributor-declared capabilities. In the 0.12 line, two new capability keys land automatically — `postgres.distinctOn` and `sql.lateral` — when the matching adapter / target component is in the contract's component graph.
|
|
165
|
+
|
|
166
|
+
### Before 0.12
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import { defineContract } from '@internal/postgres/contract-builder';
|
|
170
|
+
import { pgvector } from '@internal/pgvector';
|
|
171
|
+
|
|
172
|
+
export const contract = defineContract(
|
|
173
|
+
{
|
|
174
|
+
extensionPacks: { pgvector },
|
|
175
|
+
capabilities: {
|
|
176
|
+
postgres: {
|
|
177
|
+
lateral: true,
|
|
178
|
+
jsonAgg: true,
|
|
179
|
+
returning: true,
|
|
180
|
+
'pgvector.cosine': true,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
({ field, model }) => {
|
|
185
|
+
// … model definitions …
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Starting at 0.12
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { defineContract } from '@internal/postgres/contract-builder';
|
|
194
|
+
import { pgvector } from '@internal/pgvector';
|
|
195
|
+
|
|
196
|
+
export const contract = defineContract(
|
|
197
|
+
{
|
|
198
|
+
extensionPacks: { pgvector },
|
|
199
|
+
},
|
|
200
|
+
({ field, model }) => {
|
|
201
|
+
// … model definitions …
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
If your first argument becomes `{}` after the deletion (the only field it carried was `capabilities`), simplify to `defineContract({}, ({ field, model }) => { … })`. TypeScript flags any remaining `capabilities:` key on a `defineContract` call as an excess-property error after the bump, so every affected site is pinpointed at compile time.
|
|
207
|
+
|
|
208
|
+
### Re-emit your contract
|
|
209
|
+
|
|
210
|
+
After updating the source, regenerate the emitted artefacts so the new contributor-declared capabilities land in `contract.json` and `contract.d.ts`:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
pnpm emit
|
|
214
|
+
# (runs `prisma-next contract emit` under the hood)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
You should see capability keys appear in the regenerated `contract.json` — for SQL targets, expect `postgres.distinctOn: true` and `sql.lateral: true` to show up if your contract uses the matching adapter / extensions.
|
|
218
|
+
|
|
219
|
+
### Validation
|
|
220
|
+
|
|
221
|
+
After applying the rule above, run `pnpm typecheck && pnpm test` (or your application's equivalent). The change is mechanical and TypeScript pinpoints every affected call site; the regenerated `contract.json` diff confirms the capabilities flowed through unchanged.
|
|
222
|
+
|
|
223
|
+
## `strip-migration-labels-hints`
|
|
224
|
+
|
|
225
|
+
Starting at the 0.12 release, the migration manifest schema is closed (`'+': 'reject'`) and the metadata model no longer carries `labels` or `hints`. Any on-disk `migration.json` that still holds either key fails to load: the loader rejects the manifest with `INVALID_MANIFEST`, naming the first offending key (`labels` or `hints`). The two fields are also removed from the content-addressed migration identity — `migrationHash` is now computed over `{ from, to, providedInvariants, createdAt }` plus the sibling `ops.json` — so every migrated manifest additionally needs its hash recomputed over the slimmed envelope, or it fails hash verification on the next load.
|
|
226
|
+
|
|
227
|
+
Run the colocated codemod from your project root:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pnpm exec tsx ./strip-migration-labels-hints.ts
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
It walks every `migration.json` that has a sibling `ops.json` (a complete on-disk migration package), removes the `labels` and `hints` keys, and recomputes `migrationHash` over the slimmed metadata plus the operations. The edit is format-preserving — only the two key lines are removed and the hash value is swapped in place, so the rest of each manifest (key order, indentation, inline-vs-expanded arrays) is left untouched and the diff stays minimal. The codemod is idempotent: re-running it over already-migrated manifests makes no further changes.
|
|
234
|
+
|
|
235
|
+
### Confirm every manifest is migrated
|
|
236
|
+
|
|
237
|
+
Run the codemod in dry-run mode to confirm no manifest still carries the removed keys or a stale hash:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pnpm exec tsx ./strip-migration-labels-hints.ts --check
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`--check` lists every manifest that still needs fixing and exits non-zero if any remain, so wire it into a pre-commit hook or CI step to keep stale manifests out of the tree. A fully migrated tree reports `0 needing fix` and exits `0`.
|
|
244
|
+
|
|
245
|
+
### Validation
|
|
246
|
+
|
|
247
|
+
After running the codemod, exercise any command that loads your migrations (your deploy or migration-status step). The loader recomputes and verifies each manifest's `migrationHash` on read: a manifest that still carried `labels`/`hints` would have thrown `INVALID_MANIFEST`, and a manifest with a stale hash would fail verification. Once the codemod has run, every manifest loads cleanly and its recomputed hash verifies against the slimmed envelope.
|
|
248
|
+
|
|
249
|
+
## `re-emit-closed-mongo-contracts`
|
|
250
|
+
|
|
251
|
+
Starting at the 0.12 release, MongoDB emits **closed** `$jsonSchema` validators by default. Every object schema in the emitted contract — collection validators, nested objects, and each branch of a polymorphic `oneOf` — carries `additionalProperties: false`. The contract canonicalizer also preserves `additionalProperties` through emission, so the on-disk migration for consumers is to re-emit their Mongo contracts and apply the resulting validator change to the database.
|
|
252
|
+
|
|
253
|
+
Two authoring constraints apply before emit succeeds:
|
|
254
|
+
|
|
255
|
+
- **Closed validators** land automatically on re-emit; no hand-editing of `contract.json` is required.
|
|
256
|
+
- **Non-variant models need an `objectId` `_id`**. The new interpret-time rule `PSL_MONGO_ID_REQUIRED` rejects any non-variant Mongo model whose `_id` field does not resolve to `objectId`. Fix the PSL or TS contract source first — for example, ensure `@id` is present and typed as MongoDB's default `ObjectId` — then re-emit.
|
|
257
|
+
|
|
258
|
+
### Re-emit your Mongo contracts
|
|
259
|
+
|
|
260
|
+
Run the colocated script from your project root:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pnpm exec tsx ./re-emit-closed-mongo-contracts.ts
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
It finds every directory with a `prisma.config.ts` and a committed Mongo `contract.json`, then runs `pnpm emit` (or `prisma-next contract emit` when no emit script exists) in each. The regenerated `contract.json` / `contract.d.ts` pick up closed validators and an updated `storageHash`.
|
|
267
|
+
|
|
268
|
+
Use `--check` to list contracts that still need re-emitting without writing files:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
pnpm exec tsx ./re-emit-closed-mongo-contracts.ts --check
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Apply the validator migration
|
|
275
|
+
|
|
276
|
+
Re-emitting changes the contract's `$jsonSchema` shape. The planner classifies the open→closed validator tightening as **`destructive`** — MongoDB replaces collection validators, and documents with fields outside the closed schema will fail validation after apply.
|
|
277
|
+
|
|
278
|
+
Plan first to review the ops:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
pnpm prisma-next db update --plan-only
|
|
282
|
+
# or: prisma-next migration plan
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Then apply with explicit confirmation:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
pnpm prisma-next db update -y
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Wire `-y` into your deploy pipeline only after you have reviewed the plan in a lower environment. Without `-y`, apply refuses when destructive ops are present.
|
|
292
|
+
|
|
293
|
+
### Validation
|
|
294
|
+
|
|
295
|
+
After re-emitting and applying, run `pnpm typecheck && pnpm test` (or your application's equivalent). Contract hash/type drift shows up immediately in TypeScript imports of `StorageHash`. At runtime, confirm `db verify` passes against the updated validators.
|
|
296
|
+
|
|
297
|
+
## `public-default-namespace`
|
|
298
|
+
|
|
299
|
+
Starting at the 0.12 release, un-namespaced Postgres models resolve to the `public` namespace id instead of falling back to the `__unbound__` sentinel. The emitted contract's default storage namespace key changes from `__unbound__` with `"kind": "postgres-unbound-schema"` to `public` with `"kind": "postgres-schema"`. Domain roots, FK `namespaceId` fields, and `contract.d.ts` namespace literals follow the same rename.
|
|
300
|
+
|
|
301
|
+
Explicit opt-in to the sentinel remains available: `namespace unbound { … }` in PSL still round-trips to `__unbound__` on Postgres. Only contracts whose *default* namespace is still the old sentinel shape need this migration.
|
|
302
|
+
|
|
303
|
+
### Re-emit Postgres contracts
|
|
304
|
+
|
|
305
|
+
Run the colocated script from your project root:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
pnpm exec tsx ./re-emit-postgres-public-default.ts
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
It finds every committed `contract.json` whose storage tree still carries `"kind": "postgres-unbound-schema"`, then runs `pnpm emit` (or `prisma-next contract emit`) in the matching contract space. Use `--check` to list spaces that still need re-emitting without writing files:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
pnpm exec tsx ./re-emit-postgres-public-default.ts --check
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### After re-emit
|
|
318
|
+
|
|
319
|
+
If your database marker or migration head still references the old contract hash, plan and apply the resulting migration (`prisma-next db update --plan-only`, then `prisma-next db update -y` once reviewed). The schema ops are typically hash/metadata drift only when your PSL source did not change.
|
|
320
|
+
|
|
321
|
+
### Validation
|
|
322
|
+
|
|
323
|
+
After re-emitting, run `pnpm typecheck && pnpm test`. Inspect the `contract.json` diff: default models should sit under `storage.namespaces.public` and `domain.namespaces.public`, not `__unbound__`.
|
|
324
|
+
|
|
325
|
+
## `domain-plane-namespaced-contract`
|
|
326
|
+
|
|
327
|
+
Starting at the 0.12 release, the application plane is symmetric with storage: models and value objects live under `contract.domain.namespaces.<ns>` instead of flat `contract.models` / `contract.valueObjects` at the contract root (ADR 221). Emitted `contract.d.ts` exports `Models` via `ContractModelsMap<Contract>` rather than `Contract['models']`.
|
|
328
|
+
|
|
329
|
+
### Re-emit your contracts
|
|
330
|
+
|
|
331
|
+
Run the colocated script from your project root:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
pnpm exec tsx ./re-emit-domain-namespaced-contracts.ts
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
It finds contract spaces whose on-disk artefacts still use the flat domain shape (JSON missing `domain.namespaces`, or `contract.d.ts` still referencing `Contract['models']`), then re-emits each space. Use `--check` for a dry-run:
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
pnpm exec tsx ./re-emit-domain-namespaced-contracts.ts --check
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
If you already re-emitted for `public-default-namespace` on 0.12, a single emit pass covers both transitions — run whichever entry's detection matches your tree.
|
|
344
|
+
|
|
345
|
+
### Validation
|
|
346
|
+
|
|
347
|
+
After re-emitting, run `pnpm typecheck && pnpm test`. The regenerated `contract.json` should carry a `domain.namespaces` envelope; `contract.d.ts` should export a `Models` alias derived from the contract type (on current 0.12 builds this is typically `Contract extends ContractType<StorageBase, infer TModels> ? TModels : never`, not `ContractModelsMap`, which was removed with runtime default-namespace qualification — see `runtime-qualified-sql-default-namespace` below).
|
|
348
|
+
|
|
349
|
+
## `runtime-qualified-sql-default-namespace`
|
|
350
|
+
|
|
351
|
+
Starting at the 0.12 release, runtime SQL on Postgres qualifies table identifiers with the storage namespace the flat DSL/ORM surface resolved ([ADR 223](../../../../docs/architecture%20docs/adrs/ADR%20223%20-%20Target-owned%20default%20namespace.md)). Un-namespaced Postgres models continue to resolve through the `public` default; explicit `namespace unbound { … }` in PSL still maps to `__unbound__`.
|
|
352
|
+
|
|
353
|
+
### Application code
|
|
354
|
+
|
|
355
|
+
No change is required for normal query code:
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
await db.sql.user.findMany();
|
|
359
|
+
await db.User.findMany();
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Bare names still resolve default-namespace-first; only the emitted SQL changes.
|
|
363
|
+
|
|
364
|
+
### Tests and observability
|
|
365
|
+
|
|
366
|
+
If you assert raw SQL strings (integration tests, query logs, migration snapshots), expect qualified Postgres identifiers:
|
|
367
|
+
|
|
368
|
+
```diff
|
|
369
|
+
-FROM "user"
|
|
370
|
+
+FROM "public"."user"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
SQLite and Mongo behaviour for bare names is unchanged at the SQL/collection string level (SQLite `qualifyTable` is a no-op; Mongo has no SQL-style qualification).
|
|
374
|
+
|
|
375
|
+
### Contract artefacts
|
|
376
|
+
|
|
377
|
+
Re-emit (`pnpm emit` / `prisma-next contract emit`) is **not** required solely for this change when your PSL/contract source is already on the 0.12 namespaced shape. If you have not yet run the `domain-plane-namespaced-contract` or `public-default-namespace` transitions, complete those first — a single emit pass covers all on-disk contract updates.
|
|
378
|
+
|
|
379
|
+
### Emitted types note
|
|
380
|
+
|
|
381
|
+
If you maintain hand-written code against generated `contract.d.ts`, replace any use of removed `ContractModelsMap<Contract>` with the emitted `Models` export or `ContractModelDefinitions<YourContract>` from `@internal/contract/types`. That removal affects extension authors directly; application projects that only import the generated `Models` alias pick up the new shape on re-emit.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-emits every Mongo contract in the consumer project so emitted
|
|
3
|
+
* `contract.json` / `contract.d.ts` pick up closed `$jsonSchema`
|
|
4
|
+
* validators (`additionalProperties: false` at every level, including
|
|
5
|
+
* polymorphic `oneOf` branches).
|
|
6
|
+
*
|
|
7
|
+
* Background: starting at the 0.12 release, MongoDB emits closed
|
|
8
|
+
* `$jsonSchema` validators by default. The contract canonicalizer also
|
|
9
|
+
* preserves `additionalProperties` through emission, so re-emitting is
|
|
10
|
+
* the consumer-facing migration for on-disk contract artefacts. A
|
|
11
|
+
* non-variant Mongo model must resolve to an `objectId` `_id`; otherwise
|
|
12
|
+
* interpret fails with `PSL_MONGO_ID_REQUIRED` — fix the PSL/TS source
|
|
13
|
+
* before re-emitting.
|
|
14
|
+
*
|
|
15
|
+
* After re-emitting, apply the resulting open→closed validator migration
|
|
16
|
+
* with `prisma-next db update -y` (or `pnpm db:update -y` if your
|
|
17
|
+
* project wraps it). The planner classifies the validator tightening as
|
|
18
|
+
* `destructive`; without `-y` the apply step refuses to run.
|
|
19
|
+
*
|
|
20
|
+
* Dispatch: walks the project root for directories that contain both
|
|
21
|
+
* `prisma.config.ts` and a committed `contract.json` whose storage
|
|
22
|
+
* tree includes `"kind": "mongo-database"`. In each match, runs
|
|
23
|
+
* `pnpm emit` when a `package.json` scripts.emit entry exists, otherwise
|
|
24
|
+
* `pnpm exec prisma-next contract emit`.
|
|
25
|
+
*
|
|
26
|
+
* Flags:
|
|
27
|
+
* --check dry-run; lists directories that would be re-emitted and
|
|
28
|
+
* exits 1 if any contract.json still lacks closed validators.
|
|
29
|
+
*/
|
|
30
|
+
import { execFile } from 'node:child_process';
|
|
31
|
+
import { access, readdir, readFile } from 'node:fs/promises';
|
|
32
|
+
import { join } from 'node:path';
|
|
33
|
+
import { promisify } from 'node:util';
|
|
34
|
+
|
|
35
|
+
const execFileAsync = promisify(execFile);
|
|
36
|
+
|
|
37
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build']);
|
|
38
|
+
|
|
39
|
+
const dryRun = process.argv.includes('--check');
|
|
40
|
+
const projectRoot = process.cwd();
|
|
41
|
+
|
|
42
|
+
async function pathExists(path: string): Promise<boolean> {
|
|
43
|
+
try {
|
|
44
|
+
await access(path);
|
|
45
|
+
return true;
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function findPrismaNextConfigDirs(root: string): Promise<string[]> {
|
|
52
|
+
const out: string[] = [];
|
|
53
|
+
|
|
54
|
+
async function walk(dir: string): Promise<void> {
|
|
55
|
+
let entries: Awaited<ReturnType<typeof readdir>>;
|
|
56
|
+
try {
|
|
57
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
if (entry.isDirectory()) {
|
|
63
|
+
if (SKIP_DIRS.has(entry.name)) continue;
|
|
64
|
+
await walk(join(dir, entry.name));
|
|
65
|
+
} else if (entry.isFile() && entry.name === 'prisma.config.ts') {
|
|
66
|
+
out.push(dir);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await walk(root);
|
|
72
|
+
return out.sort();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function contractJsonCandidates(configDir: string): string[] {
|
|
76
|
+
return [
|
|
77
|
+
join(configDir, 'src', 'contract.json'),
|
|
78
|
+
join(configDir, 'src', 'prisma', 'contract.json'),
|
|
79
|
+
join(configDir, 'prisma', 'contract.json'),
|
|
80
|
+
join(configDir, 'contract.json'),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function resolveContractJson(configDir: string): Promise<string | null> {
|
|
85
|
+
for (const candidate of contractJsonCandidates(configDir)) {
|
|
86
|
+
if (await pathExists(candidate)) return candidate;
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function isMongoContract(contractPath: string): Promise<boolean> {
|
|
92
|
+
const raw = await readFile(contractPath, 'utf-8');
|
|
93
|
+
return raw.includes('"kind": "mongo-database"') || raw.includes('"kind":"mongo-database"');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A contract is in the closed-validator (post-0.12) format when every object
|
|
98
|
+
* schema that declares a `properties` map also carries `additionalProperties:
|
|
99
|
+
* false`. That covers collection validators, nested value objects, and each
|
|
100
|
+
* polymorphic `oneOf` branch — all of which expose `properties`.
|
|
101
|
+
*
|
|
102
|
+
* The one exception is a polymorphic schema's top-level node: it carries both
|
|
103
|
+
* base `properties` and a `oneOf`, and is deliberately left open because
|
|
104
|
+
* closure is enforced on each branch (a document must match exactly one closed
|
|
105
|
+
* branch). Such a node is exempt from the `additionalProperties: false`
|
|
106
|
+
* requirement, but its branches are still walked and checked.
|
|
107
|
+
*
|
|
108
|
+
* A substring scan is unsafe here: a single closed branch would mask a sibling
|
|
109
|
+
* that still needs re-emitting.
|
|
110
|
+
*/
|
|
111
|
+
/** Narrows an arbitrary JSON-parsed value to a plain object (non-null, non-array). */
|
|
112
|
+
function isJsonObject(value: unknown): value is Record<string, unknown> {
|
|
113
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function contractLooksClosed(raw: string): boolean {
|
|
117
|
+
let parsed: unknown;
|
|
118
|
+
try {
|
|
119
|
+
parsed = JSON.parse(raw);
|
|
120
|
+
} catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function isClosed(node: unknown): boolean {
|
|
125
|
+
if (Array.isArray(node)) return node.every(isClosed);
|
|
126
|
+
if (!isJsonObject(node)) return true;
|
|
127
|
+
|
|
128
|
+
const hasProperties = isJsonObject(node['properties']);
|
|
129
|
+
const isPolymorphicTopLevel = Array.isArray(node['oneOf']);
|
|
130
|
+
if (hasProperties && !isPolymorphicTopLevel && node['additionalProperties'] !== false) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return Object.values(node).every(isClosed);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return isClosed(parsed);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function packageJsonHasEmitScript(configDir: string): Promise<boolean> {
|
|
141
|
+
const pkgPath = join(configDir, 'package.json');
|
|
142
|
+
if (!(await pathExists(pkgPath))) return false;
|
|
143
|
+
const raw = await readFile(pkgPath, 'utf-8');
|
|
144
|
+
try {
|
|
145
|
+
const parsed: unknown = JSON.parse(raw);
|
|
146
|
+
if (!isJsonObject(parsed)) return false;
|
|
147
|
+
const scripts = parsed['scripts'];
|
|
148
|
+
if (!isJsonObject(scripts)) return false;
|
|
149
|
+
return typeof scripts['emit'] === 'string' && scripts['emit'].length > 0;
|
|
150
|
+
} catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function runEmit(configDir: string): Promise<void> {
|
|
156
|
+
const hasEmitScript = await packageJsonHasEmitScript(configDir);
|
|
157
|
+
const cmd = hasEmitScript ? 'pnpm' : 'pnpm';
|
|
158
|
+
const args = hasEmitScript ? ['emit'] : ['exec', 'prisma-next', 'contract', 'emit'];
|
|
159
|
+
await execFileAsync(cmd, args, { cwd: configDir, env: process.env });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const configDirs = await findPrismaNextConfigDirs(projectRoot);
|
|
163
|
+
const mongoDirs: Array<{ dir: string; contractPath: string }> = [];
|
|
164
|
+
|
|
165
|
+
for (const dir of configDirs) {
|
|
166
|
+
const contractPath = await resolveContractJson(dir);
|
|
167
|
+
if (contractPath === null) continue;
|
|
168
|
+
if (!(await isMongoContract(contractPath))) continue;
|
|
169
|
+
mongoDirs.push({ dir, contractPath });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (mongoDirs.length === 0) {
|
|
173
|
+
console.error(`No Mongo contract directories found under ${projectRoot}.`);
|
|
174
|
+
process.exit(1);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let needsFix = 0;
|
|
178
|
+
let alreadyClean = 0;
|
|
179
|
+
|
|
180
|
+
for (const { dir, contractPath } of mongoDirs) {
|
|
181
|
+
const rel = dir.slice(projectRoot.length + 1) || '.';
|
|
182
|
+
const raw = await readFile(contractPath, 'utf-8');
|
|
183
|
+
if (contractLooksClosed(raw)) {
|
|
184
|
+
alreadyClean += 1;
|
|
185
|
+
console.log(`OK ${rel}`);
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
needsFix += 1;
|
|
189
|
+
if (dryRun) {
|
|
190
|
+
console.log(`WOULD RE-EMIT ${rel}`);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
console.log(`EMIT ${rel}`);
|
|
194
|
+
await runEmit(dir);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
console.log();
|
|
198
|
+
console.log(
|
|
199
|
+
`${mongoDirs.length} Mongo contract(s): ${needsFix} ${dryRun ? 'needing re-emit' : 're-emitted'}, ${alreadyClean} already closed.`,
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
if (dryRun && needsFix > 0) process.exit(1);
|