@prisma/orm-mariadb 0.0.0-stage → 8.0.0-rc.24-dev.3
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 +48 -2
- package/dist/adapter.d.mts +1 -0
- package/dist/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/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 +10 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +17 -0
- package/dist/config.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__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 +3 -0
- package/dist/migration.mjs +3 -0
- package/dist/target__control.d.mts +3 -0
- package/dist/target__control.mjs +3 -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/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 +139 -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 +552 -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 +635 -0
- package/skills/prisma-8/references/queries-mongo.md +261 -0
- package/skills/prisma-8/references/queries-postgres.md +710 -0
- package/skills/prisma-8/references/queries.md +255 -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.21-to-8.0.0-rc.22/instructions.md +586 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/scripts/value-objects-in-storage/value-objects-in-storage.ts +1184 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +480 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/scripts/mongo-index-names/mongo-index-names.ts +317 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +319 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -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.21-to-8.0.0-rc.22/instructions.md +464 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +410 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +304 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -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.19-to-8.0.0-rc.20/instructions.md
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.19"
|
|
3
|
+
to: "8.0.0-rc.20"
|
|
4
|
+
changes:
|
|
5
|
+
- id: engine-pin-moves-to-0-9-0
|
|
6
|
+
summary: |
|
|
7
|
+
The toolchain now peers `@prisma/cli-engine@0.9.0` (up from 0.7.0). An extension package whose tests or tooling load `@prisma/cli-engine` alongside the Prisma toolchain must move it to `0.9.0`, in `package.json` or in a `pnpm-workspace.yaml` catalog. A separate CLI that the package builds on the engine is not affected. The detection matches an engine version below 0.9 in either file.
|
|
8
|
+
detection:
|
|
9
|
+
glob: "**/{package.json,pnpm-workspace.yaml}"
|
|
10
|
+
matches:
|
|
11
|
+
- '[\x27"]@prisma/cli-engine[\x27"]\s*:\s*[\x27"]?[^\x27"\n#]*(?<![\d.])0\.[0-8](?!\d)'
|
|
12
|
+
- id: piped-output-needs-json
|
|
13
|
+
summary: |
|
|
14
|
+
A piped Prisma ORM command no longer prints JSON. A test that runs the CLI with a non-terminal stdout and parses JSON frames from it must pass `--json`.
|
|
15
|
+
- id: stored-contracts-expand-type-aliases
|
|
16
|
+
summary: |
|
|
17
|
+
A stored SQL contract whose columns name a type alias in `typeRef` no longer loads. Run `scripts/expand-type-aliases/expand-type-aliases.ts` from the extension's package root, then re-emit the bundled contract. If the re-emit drops a type alias that no field uses, add a migration with no operations to the re-emitted hash, move the head ref to it, and add it to the migrations the descriptor ships. The script writes each alias's parameters into the columns typed by it, in every stored contract the extension ships, its migration snapshots included, and rewrites the hashes and references that change.
|
|
18
|
+
detection:
|
|
19
|
+
glob: "**/contract.json"
|
|
20
|
+
matches:
|
|
21
|
+
- '"typeRef"\s*:'
|
|
22
|
+
script: ./scripts/expand-type-aliases/expand-type-aliases.ts
|
|
23
|
+
- id: types-key-is-database-types
|
|
24
|
+
summary: |
|
|
25
|
+
A TypeScript contract space that registers a database type now writes it under `databaseTypes` instead of `types`. Rename the key and keep its entries. `defineContract` refuses a `types` key with `CONTRACT.TYPES_KEY_REMOVED`. The contract and its storage hash do not change. The detection matches a `types` key whose entries are `kind: 'codec-instance'` literals.
|
|
26
|
+
detection:
|
|
27
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
28
|
+
matches:
|
|
29
|
+
- '(?<![\w$.\x27"])types\s*:\s*\{\s*(?:\[[^\]]*\]|[\w$]+|[\x27"][^\x27"]*[\x27"])\s*:\s*\{\s*kind\s*:\s*[\x27"]codec-instance[\x27"]'
|
|
30
|
+
- id: column-type-ref-removed
|
|
31
|
+
summary: |
|
|
32
|
+
`ColumnTypeDescriptor.typeRef`, `StorageColumn.typeRef` and `ExecutionContext.types` are removed. Read a column's codec and parameters from its own `codecId` and `typeParams`. The codec instance of a parameterized column is now named `<col:Table.column>`, never after a type alias. The detection matches TypeScript that reads `typeRef` or the execution context's `types`.
|
|
33
|
+
detection:
|
|
34
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
35
|
+
matches:
|
|
36
|
+
- '(?<![\w$])typeRef(?![\w$])'
|
|
37
|
+
- '[cC]ontext\.types(?![\w$])'
|
|
38
|
+
- id: type-alias-descriptor
|
|
39
|
+
summary: |
|
|
40
|
+
No action is needed. A pack may now contribute a type alias in its `type` namespace, a descriptor of `kind: 'typeAlias'` whose output names a column type and optional `onCreate` and `onUpdate` generator calls. Assembly refuses, with `CONTRACT.PACK_CONTRIBUTION_INVALID`, fixed type parameters the codec's parameter schema refuses and a generator call that does not resolve for the codec.
|
|
41
|
+
- id: entity-context-data-types
|
|
42
|
+
summary: |
|
|
43
|
+
`AuthoringEntityContext` has a required `dataTypes: DataTypeSupport`, the stack's data types with their authoring entries, in place of `dataTypeLookup`; its `readWrittenValueForCodec` hook and the `WrittenValueReading` type are removed. Where an extension builds an `AuthoringEntityContext`, replace `dataTypeLookup` with `dataTypes` from the contract source context or the assembled stack (`assembleDataTypeSupport`), and read the data type lookup as `ctx.dataTypes.lookup`. To read a written value into a codec, call `readWrittenValueIntoCodec({ support, codecLookup, ref, written, subject })` from `@internal/framework-components/authoring`, which returns the stored value or a refusal with its code and message. The detection matches code that uses the removed hook or type, builds the context by hand, or reads `dataTypeLookup` from a context.
|
|
44
|
+
detection:
|
|
45
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
46
|
+
matches:
|
|
47
|
+
- '(?<![\w$])readWrittenValueForCodec(?![\w$])'
|
|
48
|
+
- '(?<![\w$])WrittenValueReading(?![\w$])'
|
|
49
|
+
- ':\s*AuthoringEntityContext\s*=\s*\{'
|
|
50
|
+
- '(?<![\w$])ctx\.dataTypeLookup(?![\w$])'
|
|
51
|
+
- id: enum-block-members-written-values
|
|
52
|
+
summary: |
|
|
53
|
+
`readEnumBlockMembers` reads every member through `readWrittenValueIntoCodec` and no longer reads a member's value as JSON. A block member with a value must have an entry in the block's `writtenValues`, which the PSL block interpreter records for every literal and for a list of literals; a member without one throws an `InternalError`, and a bare member is read from its name. `writtenValues` now holds a `WrittenValue`, which may be a list. An extension that builds an enum block itself sets `writtenValues` for each member with a value, as `{ kind: 'string', text }` for text. The detection matches code that calls `readEnumBlockMembers` or reads `writtenValues`.
|
|
54
|
+
detection:
|
|
55
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
56
|
+
matches:
|
|
57
|
+
- '(?<![\w$])readEnumBlockMembers\('
|
|
58
|
+
- '\.writtenValues(?![\w$])'
|
|
59
|
+
- id: access-changes-rename
|
|
60
|
+
summary: |
|
|
61
|
+
`accessWidening` is renamed `accessChanges` on `MigrationPlanSubjects` (from `@prisma/orm-framework/components/control`) and on every type that extends it: `MigrationPlannerSuccessResult`, `PerSpacePlan` and `DbUpdateSuccess`. The subjects argument of `plannerSuccess` from `@prisma/orm-family-sql/family/control` takes `accessChanges`, and the control API option `acceptAccessWidening` becomes `acceptAccessChanges`. There is no alias for the old names.
|
|
62
|
+
detection:
|
|
63
|
+
glob: "**/*.{ts,tsx,mts,cts,js,mjs,cjs}"
|
|
64
|
+
matches:
|
|
65
|
+
- '(?<![\w$])(?:acceptAccessWidening|accessWidening)(?![\w$])'
|
|
66
|
+
- id: statement-planning-target-namespaces
|
|
67
|
+
summary: |
|
|
68
|
+
In `@prisma/orm-family-sql/family/control`, `SchemaTables` gains `hasNamespace(namespaceId)`, and `StatementPlanningTarget` gains an optional `namespaces` member. A `SchemaTables` or a test double of it adds `hasNamespace`; a target with several namespaces may add `namespaces`.
|
|
69
|
+
detection:
|
|
70
|
+
glob: "**/*.{ts,mts,cts}"
|
|
71
|
+
matches:
|
|
72
|
+
- '(?<![\w$])(?:StatementPlanningTarget|SchemaTables)(?![\w$])'
|
|
73
|
+
- id: schema-ownership-namespace-spaces
|
|
74
|
+
summary: |
|
|
75
|
+
`SchemaOwnership` from `@prisma/orm-framework/components/control` gains `namespaceDeclaringSpaces(namespaceId)`: the ids of the contract spaces that declare the namespace. A test double of it adds the method.
|
|
76
|
+
detection:
|
|
77
|
+
glob: "**/*.{ts,mts,cts}"
|
|
78
|
+
matches:
|
|
79
|
+
- '(?<![\w$])SchemaOwnership(?![\w$])'
|
|
80
|
+
- id: namespace-rename-statement
|
|
81
|
+
summary: |
|
|
82
|
+
`ResolvedRenameStatement` from `@prisma/orm-framework/components/control` gains `ResolvedNamespaceRenameStatement`, `{ kind: 'rename', entity: 'namespace', from, to }`, whose `from` and `to` are namespace ids. Code that switches over a rename's `entity` handles `'namespace'`.
|
|
83
|
+
detection:
|
|
84
|
+
glob: "**/*.{ts,mts,cts}"
|
|
85
|
+
matches:
|
|
86
|
+
- '(?<![\w$])ResolvedRenameStatement(?![\w$])'
|
|
87
|
+
- id: check-expectation
|
|
88
|
+
summary: |
|
|
89
|
+
A migration check that expects one object to be absent or present can now say so in an optional `expectation` field, and a failed precheck's message then names the object: `That check failed: the database already has index "Item_state_idx".` instead of `That check failed on this database.` Checks written without it keep working and keep the generic sentence.
|
|
90
|
+
detection:
|
|
91
|
+
glob: "**/ops.json"
|
|
92
|
+
matches:
|
|
93
|
+
- '(?:\{\s*"description": "(?:[^"\\]|\\.)*",\s*"sql": "(?:SELECT (?:NOT )?EXISTS \(SELECT 1 AS \\"one\\" FROM \\"(?:information_schema\\"\.\\"columns|pg_extension|pg_constraint|pg_class|pg_policies|pg_type|pg_enum|pg_indexes|pg_namespace)\\"(?: AS \\"\w+\\")?(?: INNER JOIN \\"pg_(?:namespace|type|class)\\" AS \\"\w+\\" ON \\"\w+\\"\.\\"\w+\\" = \\"\w+\\"\.\\"\w+\\")* WHERE (?:[^"\\]|\\"(?:table_schema|table_name|column_name|extname|conname|connamespace|conrelid|nspname|schemaname|tablename|policyname|indexname|typname|typnamespace|enumlabel|enumtypid|relname|relkind|oid|type|name|c|n|t|e|i|p)\\")*?\) AS \\"result\\"|SELECT \(to_regclass\(\$\d+\)\) IS (?:NOT )?NULL AS \\"result\\"|SELECT COUNT\(\*\) (?:= 0|> 0) AS \\"result\\" FROM (?:\\"sqlite_master\\"|pragma_table_info\([^)"]*\)|pragma_index_list\([^)"]*\)) WHERE (?:[^"\\]|\\"(?:table_schema|table_name|column_name|extname|conname|connamespace|conrelid|nspname|schemaname|tablename|policyname|indexname|typname|typnamespace|enumlabel|enumtypid|relname|relkind|oid|type|name|c|n|t|e|i|p)\\")*?)"(?:,\s*"params": \[[^\]]*\])?\s*\}|"source": \{\s*"kind": "list(?:Indexes|Collections)"(?:,\s*"collection": "(?:[^"\\]|\\.)*")?\s*\},\s*"filter": \{\s*"kind": "field",(?:[^{}]|\{[^{}]*\})*\},\s*"expect": "(?:exists|notExists)"\s*\})'
|
|
94
|
+
- id: check-expectation-raw-sql
|
|
95
|
+
summary: |
|
|
96
|
+
A precheck or postcheck you write by hand in a `rawSql` operation of a `migration.ts` can carry `expectation`, `{ expects: 'absent' | 'present', object }`, so a failure of it names the object. Add it where the check asks whether one object exists, then run `node migration.ts` for a migration no database has applied yet.
|
|
97
|
+
detection:
|
|
98
|
+
glob: "**/migration.ts"
|
|
99
|
+
matches:
|
|
100
|
+
- '\brawSql\(\{[\s\S]*?\b(?:precheck|postcheck):\s*\[(?:\s*\{(?:[^{}]|\{[^{}]*\})*\},)*?\s*\{[^{}]*\}'
|
|
101
|
+
- id: sql-builder-insert-required-columns
|
|
102
|
+
summary: |
|
|
103
|
+
A SQL builder insert, `db.sql.<namespace>.<table>.insert(rows)`, must now include every column that is not nullable and has no default. Leaving one out is a type error that names the column, and so is a value typed `T | undefined` for such a column. Add a real value, narrowed to `T`.
|
|
104
|
+
detection:
|
|
105
|
+
glob: "**/*.{ts,tsx,mts,cts}"
|
|
106
|
+
matches:
|
|
107
|
+
- '\.insert\('
|
|
108
|
+
- id: supabase-for-role-replaces-with-role-methods
|
|
109
|
+
summary: |
|
|
110
|
+
`SupabaseRuntime` no longer has `queryWithRole`, `executeWithRole`, `preparedQueryWithRole` or `preparedExecuteWithRole`, and `SupabaseRuntimeImpl` no longer has `roleActivitySource`. Call `runtime.forRole(binding)` once and use its members: `runtime.queryWithRole(plan, binding, options)` becomes `runtime.forRole(binding).query(plan, options)`, `executeWithRole` becomes `forRole(binding).execute`, a prepared statement runs on the role with `statement.query(runtime.forRole(binding), params)` or `statement.execute(runtime.forRole(binding), params)`, and the role's activity source is the `activitySource` member of `forRole(binding)`. The detection matches files that call one of the removed methods.
|
|
111
|
+
detection:
|
|
112
|
+
glob: "**/*.{ts,mts,cts,tsx,js,mjs,cjs}"
|
|
113
|
+
matches:
|
|
114
|
+
- '\.(?:queryWithRole|executeWithRole|preparedQueryWithRole|preparedExecuteWithRole|roleActivitySource)\('
|
|
115
|
+
- id: supabase-role-types-gain-members
|
|
116
|
+
summary: |
|
|
117
|
+
Three public Supabase types require new members, so a test double or hand-built object typed with them stops compiling. `RoleBoundDb` and `ServiceRoleDb` gain `enums` and `nativeEnums`. `SupabaseTransactionContext` is now `PostgresTransactionContext`, so it gains `enums` and `nativeEnums` too. `SupabaseRuntime` requires `forRole(binding)`, which returns a `SupabaseRoleScope` (`query`, `execute`, the prepared-statement operations and `connection`), in place of the four removed `*WithRole` methods. Add the members to each double: take `enums` and `nativeEnums` from `postgresStatic({ contract })` of `@prisma/orm-postgres/static`, or from a role-bound client. The detection matches files that name one of these types.
|
|
118
|
+
detection:
|
|
119
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
120
|
+
matches:
|
|
121
|
+
- '(?<![\w$])(?:RoleBoundDb|ServiceRoleDb|SupabaseTransactionContext|SupabaseRuntime)(?![\w$])'
|
|
122
|
+
- id: raw-connection-obeys-close
|
|
123
|
+
summary: |
|
|
124
|
+
`SqlRuntimeBase.acquireRawConnection()` now follows the close rule of `connection()`: once the runtime starts refusing new work it rejects with `DRIVER.NOT_CONNECTED` "Runtime is closed" (at once with `closeRefusal: 'at-once'`, after the runtime has been idle for a turn of the event loop with `'when-idle'`), unless you pass `{ activityParent }` of an activity that is still open; the statements and transactions run on the connection are work `close()` waits for, and a connection held between statements is not. A transaction now counts as work from its start until its commit or rollback settles, its commit fails, or its connection is released or destroyed, so `close()` waits for an open transaction on any connection and, while it waits only for transactions still open, logs `runtime.close.waiting-for-activities` with `openTransactions`, their count; it waits for each until it commits or rolls back. A subclass that shares its driver with another runtime builds each runtime with the new `ownsDriver: false` option, closes them all, then closes the driver once. The detection matches files that call `acquireRawConnection`.
|
|
125
|
+
detection:
|
|
126
|
+
glob: "**/*.{ts,mts,cts,tsx}"
|
|
127
|
+
matches:
|
|
128
|
+
- '(?<![\w$])acquireRawConnection\('
|
|
129
|
+
- id: supabase-pg-takes-a-pool
|
|
130
|
+
summary: |
|
|
131
|
+
The `pg` option of `supabase()` takes a `pg.Pool` only. A `pg.Client` is a type error and fails at `supabase()` with `SUPABASE.CONFIG_INVALID`. Replace `pg: new Client(...)` with `pg: new Pool(...)` built from the same settings, or pass `url`. The detection matches every `supabase()` call that passes `pg`; leave a call that already passes a `pg.Pool` as it is.
|
|
132
|
+
detection:
|
|
133
|
+
glob: "**/*.{ts,mts,cts,tsx,js,mjs,cjs}"
|
|
134
|
+
matches:
|
|
135
|
+
- '(?<![\w$.])supabase(?:<[^>]*>)?\(\s*\{(?:[^{}]|\{[^{}]*\})*?(?<![\w$.])pg\s*[:,}]'
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
# 8.0.0-rc.19 → 8.0.0-rc.20 — Extension author upgrade instructions
|
|
139
|
+
|
|
140
|
+
One change comes with a script. Run `stored-contracts-expand-type-aliases` before you re-emit the extension's bundled contract. Make the other changes, then re-emit the bundled contract once.
|
|
141
|
+
|
|
142
|
+
## CLI engine 0.9.0
|
|
143
|
+
|
|
144
|
+
### `engine-pin-moves-to-0-9-0`
|
|
145
|
+
|
|
146
|
+
This applies to tests and tooling that load `@prisma/cli-engine` alongside the Prisma toolchain. A separate CLI that the package builds on the engine runs its own engine, so it does not have to move with this upgrade.
|
|
147
|
+
|
|
148
|
+
For every `package.json` or `pnpm-workspace.yaml` catalog matched by `detection`, change the `@prisma/cli-engine` version (`0.7.0`, `^0.7.0` or any other 0.x below 0.9) to `0.9.0` and reinstall.
|
|
149
|
+
|
|
150
|
+
### `piped-output-needs-json`
|
|
151
|
+
|
|
152
|
+
Engine 0.9.0 chooses the output format from flags only. Before, a run whose stdout was not a terminal printed JSON frames; now it prints the human card on stderr and the command's data lines on stdout. The engine's test harness from `@prisma/cli-engine/testing` treats stdout as a pipe unless `isTty.stdout` is set, so it is affected the same way.
|
|
153
|
+
|
|
154
|
+
Find the tests and tooling that run a Prisma ORM command, through a spawned `prisma` process or `createTestCli`, and read JSON from its output: they parse the `result` frame of its stdout, read `json` from the harness run, or read `presented.presentation.json`. Add `--json` to the argv of each such run. A run in human format still returns the command's document as `presented.data`, so a test that reads only that needs no change.
|
|
155
|
+
|
|
156
|
+
## Type aliases are written into each column
|
|
157
|
+
|
|
158
|
+
A type alias is now authoring shorthand only. The contract no longer stores an alias in `storage.types` with a `typeRef` on each column that uses it. Each column stores its own codec and parameters, and `storage.types` holds only the database types a contract space registers, such as pgvector's `vector`.
|
|
159
|
+
|
|
160
|
+
### `stored-contracts-expand-type-aliases`
|
|
161
|
+
|
|
162
|
+
Migration snapshots that an extension ships, its bundled `contract.json`, and any other stored contract written by an earlier release may have a column with a `typeRef`. This release refuses such a contract and says to re-emit it. A historical snapshot cannot be re-emitted from today's source, so run the script instead. Do this before you re-emit the bundled contract, and commit your work first so the script's changes can be reviewed and undone with git. Run it from the extension's package root:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
node <guide>/scripts/expand-type-aliases/expand-type-aliases.ts
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`<guide>` is the directory that holds this guide. Node 24 or later runs the TypeScript script directly; it needs no `tsx`. The script reads and writes files only and needs no database. It rewrites every SQL contract under the root, skipping `node_modules`, `dist`, `build` and every directory whose name starts with `.`, such as `.git` and the worktrees under `.claude/worktrees/`. That includes test fixtures: if you keep an old contract on purpose, restore it with git afterwards.
|
|
169
|
+
|
|
170
|
+
In each contract it replaces every column's `typeRef` with the parameters of the `storage.types` entry it names, and removes each entry a column named. It makes the same change in the `contract.d.ts` next to the contract. The extension's own contract space is an extension's space, because its `migrations/` directory holds `refs/` directly, so an entry that no column names is kept, as a database type the contract registers, and the script lists it. The script cannot tell such an entry from an alias your source declares but no field uses, so it keeps both. A re-emit drops an unused alias, so the bundled contract then gets another storage hash than the one the script wrote into `migrations/refs/head.json`. Do not change the script's output to match: each application runs the same script on its own copy of your migrations and gets the hash the script wrote. Add a migration to the re-emitted contract instead, as described after the re-emit below.
|
|
171
|
+
|
|
172
|
+
The storage hash changes, so the script also renames each changed snapshot directory to its new hash. It rewrites every `migration.json`, ref, `migration.ts` and `contract.d.ts` that names an old hash, and gives each changed migration a new `migrationHash`. When it finishes, it prints how many files it rewrote, how many snapshot directories it renamed, each storage hash it replaced (`<old> -> <new>`), each `storage.types` entry it removed, per contract, and each entry it kept. A package with no `typeRef` is left unchanged, and the script says so.
|
|
173
|
+
|
|
174
|
+
It changes no file and exits 1, naming the file, when a `contract.json`, `migration.json`, `ops.json` or ref is not valid JSON; when a contract's stored storage hash or snapshot directory name does not match its content; when a column names an alias `storage.types` does not declare, stores both `typeRef` and `typeParams`, or has a codec or data type other than its alias's; when a migration with no data operation goes between two snapshots that become the same snapshot once their aliases are written into their columns, because it only introduced or renamed an alias; or when a renamed snapshot directory already exists with different content. In the first three cases, restore that file from version control, or re-emit it, and run the script again. When two snapshots become one, the script names each migration between them that has no data operation, because after the upgrade it would go from a snapshot to itself, which only a migration with a data operation may do. Delete its directory and run the script again. When that migration is your latest, nothing else names its target snapshot, so the script names that snapshot directory too; delete it as well. The script then writes the merged snapshot's hash into every `migration.json`, ref and `migration.ts` that names either old hash, and gives each changed migration a new `migrationHash`. If it stops partway, for example on a full disk, it says so; run it again to finish.
|
|
175
|
+
|
|
176
|
+
Then re-emit the bundled contract with the extension's own emit script, and ship the new `contract.json` and `contract.d.ts` together. A bundled contract written in PSL may keep its `types {}` aliases.
|
|
177
|
+
|
|
178
|
+
If the re-emitted `storage.storageHash` differs from the hash in `migrations/refs/head.json`, the re-emit dropped an alias that no field uses. An application would then refuse to load the extension with `MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH`, because the head ref must name the bundled contract's hash. Write a migration with no operations from the head ref's hash to the re-emitted hash, in a new directory under `migrations/`. Import `Migration` and `MigrationCLI` from your target's migration module, as your existing `migration.ts` files do. The example uses Postgres's, `@internal/postgres/migration`:
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
#!/usr/bin/env -S node
|
|
182
|
+
import { Migration, MigrationCLI } from '@internal/postgres/migration';
|
|
183
|
+
|
|
184
|
+
export default class M extends Migration {
|
|
185
|
+
override describe() {
|
|
186
|
+
return { from: '<the hash in migrations/refs/head.json>', to: '<the re-emitted storageHash>' };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
override get operations() {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
MigrationCLI.run(import.meta.url, M);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Run `node migration.ts` in that directory to write its `ops.json` and `migration.json`. Copy the re-emitted `contract.json` and `contract.d.ts` into `migrations/snapshots/<the re-emitted storageHash>/`. Then set `hash` in `migrations/refs/head.json` to the re-emitted hash, and keep its `invariants`. The new migration changes nothing in the database.
|
|
198
|
+
|
|
199
|
+
Then add the new migration to the migrations your descriptor ships, after the existing ones. An application gets the extension's migrations only from that list. Without it, an application's database that is empty or at the head ref's old hash cannot reach the new head. In pgvector, PostGIS and ParadeDB the list is the `migrations` argument of `contractSpaceFromJson`:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import removeUnusedAliasMetadata from '../../migrations/<the new directory>/migration.json' with { type: 'json' };
|
|
203
|
+
import removeUnusedAliasOps from '../../migrations/<the new directory>/ops.json' with { type: 'json' };
|
|
204
|
+
|
|
205
|
+
const contractSpace = contractSpaceFromJson<Contract<SqlStorage>>({
|
|
206
|
+
contractJson,
|
|
207
|
+
migrations: [
|
|
208
|
+
{ dirName: BASELINE_DIR_NAME, metadata: baselineMetadata, ops: baselineOps },
|
|
209
|
+
{ dirName: '<the new directory>', metadata: removeUnusedAliasMetadata, ops: removeUnusedAliasOps },
|
|
210
|
+
],
|
|
211
|
+
headRef,
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
If the storage hash of the bundled contract changed, tell the applications that use the extension, in your release notes, to run `prisma db sign` against every database after they upgrade, and name the old and new hash. The old hash is the one the bundled contract had before you ran the script, and the new hash is the one in `migrations/refs/head.json` when you publish. The Supabase extension's contract is an example: its hash changes from `292489649ae6d6928de98a32b544bd9caf6b7d49718c10fe2720b83545a4b5a2` to `110ad99e1e466691bdb0a4349a17365561e76ad017f58beb272f4496b05b8e9e`. Tell them too that `prisma migration status` no longer marks the extension's migrations applied before the upgrade as applied, because each rewritten migration has a new hash. `prisma db migrate` runs none of them again, and `prisma db verify` passes. A database that has not applied every migration yet is refused by a plain `prisma db sign`, and `prisma db migrate` stops on it with `MIGRATION.MARKER_MISMATCH`: tell them to sign it with `prisma db sign --contract <the last migration it applied>` and then run `prisma db migrate`, as the app guide's `stored-contracts-expand-type-aliases` says.
|
|
216
|
+
|
|
217
|
+
### `types-key-is-database-types`
|
|
218
|
+
|
|
219
|
+
A contract space that registers a database type, because PSL has no syntax for an extension to register one, writes it under `databaseTypes`:
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
// Before
|
|
223
|
+
export const contract = defineContract({ codecLookup, dataTypeLookup }, () => ({
|
|
224
|
+
types: {
|
|
225
|
+
[PGVECTOR_NATIVE_TYPE]: { kind: 'codec-instance', codecId: VECTOR_CODEC_ID, typeParams: {} },
|
|
226
|
+
},
|
|
227
|
+
models: {},
|
|
228
|
+
}));
|
|
229
|
+
|
|
230
|
+
// After
|
|
231
|
+
export const contract = defineContract({ codecLookup, dataTypeLookup }, () => ({
|
|
232
|
+
databaseTypes: {
|
|
233
|
+
[PGVECTOR_NATIVE_TYPE]: { kind: 'codec-instance', codecId: VECTOR_CODEC_ID, typeParams: {} },
|
|
234
|
+
},
|
|
235
|
+
models: {},
|
|
236
|
+
}));
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The emitted contract is the same, so its storage hash does not change. No column can reference a `databaseTypes` entry: `field.namedType(...)` now takes only an enum handle. If the `types` key held aliases that fields used through `field.namedType(types.X)`, write each as a constant instead, `const X = field.column(type.Y(...))`, and use the constant as the field. Then re-emit the bundled contract.
|
|
240
|
+
|
|
241
|
+
### `column-type-ref-removed`
|
|
242
|
+
|
|
243
|
+
Code that reads storage gets the column's type from the column itself:
|
|
244
|
+
|
|
245
|
+
- `StorageColumn` and `ColumnTypeDescriptor` have no `typeRef`. Read `codecId` and `typeParams` from the column. A validated contract never has a `typeRef`, so there is no alias to look up in `storage.types`.
|
|
246
|
+
- `ExecutionContext.types` and the `TypeHelperRegistry` are removed. Get a column's codec from the codec registry, for example through `codecRefForColumn(table, column)`.
|
|
247
|
+
- A codec instance's `name` in its `CodecInstanceContext` is `<col:Table.column>` for a parameterized column, the first column with that codec and those parameters. It used to be the alias's name for columns typed by an alias. Columns with the same codec and parameters still share one instance, and its `usedAt` lists them all. A codec that keyed per-instance state by the alias name must key it by its parameters instead.
|
|
248
|
+
- `planTypeOperations` and `verifyType` still run for each `storage.types` entry, which is now only a registered database type.
|
|
249
|
+
|
|
250
|
+
A hit in a generated `contract.d.ts` is rewritten by `stored-contracts-expand-type-aliases`; do not edit it by hand.
|
|
251
|
+
|
|
252
|
+
### `type-alias-descriptor`
|
|
253
|
+
|
|
254
|
+
There is nothing to change. A pack's `type` namespace may now contain a type alias:
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
CreatedAt: {
|
|
258
|
+
kind: 'typeAlias',
|
|
259
|
+
documentation: 'A timestamp the client sets to now when a row is created.',
|
|
260
|
+
output: { type: { codecId: 'pg/timestamptz-temporal@1' }, onCreate: { name: 'now', args: {} } },
|
|
261
|
+
},
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
It takes no arguments. PSL writes it bare as a field type (`temporal.CreatedAt`), and TypeScript as `field.column(type.temporal.CreatedAt())`. Each `onCreate` and `onUpdate` call is resolved by the column's codec, and assembly refuses a call that does not resolve with `CONTRACT.PACK_CONTRIBUTION_INVALID`.
|
|
265
|
+
|
|
266
|
+
## Written values are read into a codec by one framework function
|
|
267
|
+
|
|
268
|
+
Enum members and `@@base` values are read by `readWrittenValueIntoCodec` in `@internal/framework-components/authoring`, in every family. It replaces the `readWrittenValueForCodec` hook on `AuthoringEntityContext`, which now carries the stack's `dataTypes` in place of the hook and of `dataTypeLookup`:
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
const context: AuthoringEntityContext = {
|
|
272
|
+
family,
|
|
273
|
+
target,
|
|
274
|
+
codecLookup,
|
|
275
|
+
dataTypes,
|
|
276
|
+
};
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
A discriminator and its variants' values are decided by `applyDiscriminatorRule`, and its refusals worded for PSL by `describeDiscriminatorRefusal`, both in the same entry point; a target names its text data types in `authoring.textDataTypes`.
|
|
280
|
+
|
|
281
|
+
## `accessWidening` is renamed `accessChanges`
|
|
282
|
+
|
|
283
|
+
A migration planner lists each operation that changes who can read or write data. Such an operation does not always widen access, so the list is now `accessChanges`. Each entry is still a `MigrationAccessChange`, with `widens` saying whether it widens access. Rename the property wherever a planner, a test double or a hand-built plan sets or reads it:
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
// Before
|
|
287
|
+
return { kind: 'success', plan, appliedStatements, dataLoss: [], accessWidening: [], temporaryValues: [] };
|
|
288
|
+
plannerSuccess(plan, appliedStatements, { dataLoss: [], accessWidening: [], temporaryValues: [] });
|
|
289
|
+
|
|
290
|
+
// After
|
|
291
|
+
return { kind: 'success', plan, appliedStatements, dataLoss: [], accessChanges: [], temporaryValues: [] };
|
|
292
|
+
plannerSuccess(plan, appliedStatements, { dataLoss: [], accessChanges: [], temporaryValues: [] });
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
A caller of the control API's `executeDbUpdate` or `dbUpdate` renames the option `acceptAccessWidening` to `acceptAccessChanges`, and reads `accessChanges` from a `DbUpdateSuccess`.
|
|
296
|
+
|
|
297
|
+
## Statements can move tables and rename namespaces
|
|
298
|
+
|
|
299
|
+
### `statement-planning-target-namespaces`
|
|
300
|
+
|
|
301
|
+
A SQL target's statement planner now moves a table to another namespace and renames a namespace. Add `hasNamespace` to each `SchemaTables` you implement:
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
hasNamespace: (namespaceId) => namespaceId === UNBOUND_NAMESPACE_ID,
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
A target with one namespace, as SQLite has, leaves out `namespaces` on its `StatementPlanningTarget`; the planner then refuses a namespace rename or a model move with a `statementRefused` conflict. A target with several namespaces adds `namespaces: { createNamespaceCalls, moveTableCall, namespaceRenameRefusal, renameNamespaceCall }`, returning the calls that create a namespace, move a table and rename a namespace, which it applies to its working schema. `namespaceRenameRefusal` returns `{ reason, fix }` for a namespace it cannot rename for a reason of its own, such as Postgres's `public`; the planner itself refuses a namespace another contract space declares.
|
|
308
|
+
|
|
309
|
+
### `schema-ownership-namespace-spaces`
|
|
310
|
+
|
|
311
|
+
Add `namespaceDeclaringSpaces: () => []` to a `SchemaOwnership` test double that declares no namespace, or return the ids of the spaces whose contracts have the namespace in `storage.namespaces`.
|
|
312
|
+
|
|
313
|
+
### `namespace-rename-statement`
|
|
314
|
+
|
|
315
|
+
A `switch` or `if` over `statement.entity` of a `ResolvedRenameStatement` gains a `'namespace'` branch. A planner that cannot rename a namespace refuses the statement with a `statementRefused` conflict.
|
|
316
|
+
|
|
317
|
+
## Checks say which object they expect absent or present
|
|
318
|
+
|
|
319
|
+
Before an operation runs, the migration runner runs its prechecks. When one fails, the error's `why` named the check and said only that it failed on this database. A check that expects one object to be absent or present can now carry that as data, in `expectation`, and the `why` then says what the database already has or lacks. On MongoDB, a check carries the object's name in `object`, and its `expect` says whether it should exist.
|
|
320
|
+
|
|
321
|
+
Nothing breaks without it. An `ops.json` that has no `expectation` reads, verifies its hash and runs as before.
|
|
322
|
+
|
|
323
|
+
### Migrations Prisma writes
|
|
324
|
+
|
|
325
|
+
The PostgreSQL, SQLite and MongoDB operations now write it on every check that asks only whether one object exists. A matched `ops.json`, or a MongoDB `ops.json` written before this change, gains it when you write it again: run its `migration.ts` (`node migration.ts`). Writing it again changes its hash, so do this only for a migration that no database has applied yet. Leave an applied migration as it is.
|
|
326
|
+
|
|
327
|
+
Do not write a migration your extension has already published again: the apps that applied it recorded its hash. The rewrite that `stored-contracts-expand-type-aliases` makes is different: every application runs the same script on its own copy of your migrations.
|
|
328
|
+
|
|
329
|
+
### Checks you write yourself
|
|
330
|
+
|
|
331
|
+
In your extension's migrations, a check you write in a `rawSql` operation can carry it too. Add `expectation` to the precheck or postcheck step, with `expects: 'absent'` or `'present'` and the object as a reader would name it, then run `node migration.ts`:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
rawSql({
|
|
335
|
+
// ...
|
|
336
|
+
precheck: [
|
|
337
|
+
{
|
|
338
|
+
description: 'verify extension "vector" is not already enabled',
|
|
339
|
+
sql: "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')",
|
|
340
|
+
expectation: { expects: 'absent', object: 'extension "vector"' },
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
})
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Leave it out of a check about data or about several objects at once, such as a check that a column holds no NULL values.
|
|
347
|
+
|
|
348
|
+
## Inserts must include the columns the database requires
|
|
349
|
+
|
|
350
|
+
The SQL builder's `insert` now requires every column that is not nullable and has no default. A column is still optional when it is nullable, has a default (`@default(...)`, including `now()` and `autoincrement()`), or is generated on create (`@onCreate(...)` or a preset that generates on create).
|
|
351
|
+
|
|
352
|
+
For each insert in your extension's code that stops compiling, add a real value for each column the error names. Do not cast the row. A required property does not accept `undefined`, so a value typed `T | undefined` for one of these columns must be checked before the insert.
|
|
353
|
+
|
|
354
|
+
## Supabase runs every role operation through one object
|
|
355
|
+
|
|
356
|
+
`SupabaseRuntime.forRole(binding)` returns a `SupabaseRoleScope`, the runtime operations under one role: `query`, `execute`, the prepared-statement operations and `connection`. Run a transaction under the role with `withTransaction(runtime.forRole(binding), fn)`.
|
|
357
|
+
|
|
358
|
+
| Type | New required members |
|
|
359
|
+
| --- | --- |
|
|
360
|
+
| `RoleBoundDb`, `ServiceRoleDb` | `enums`, `nativeEnums` |
|
|
361
|
+
| `SupabaseTransactionContext` | `enums`, `nativeEnums` (it is now `PostgresTransactionContext`) |
|
|
362
|
+
| `SupabaseRuntime` | `forRole(binding)`, in place of the four `*WithRole` methods |
|
|
363
|
+
|
|
364
|
+
```ts
|
|
365
|
+
// Before
|
|
366
|
+
const rows = await runtime.queryWithRole(plan, { role: 'anon' }).toArray();
|
|
367
|
+
|
|
368
|
+
// After
|
|
369
|
+
const rows = await runtime.forRole({ role: 'anon' }).query(plan).toArray();
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
The statements and the open transactions on a raw connection keep `close()` waiting; a connection held between statements does not, so release it when you are done:
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
const connection = await this.acquireRawConnection({ activityParent });
|
|
376
|
+
try {
|
|
377
|
+
await connection.execute({ sql: 'SELECT 1' });
|
|
378
|
+
} finally {
|
|
379
|
+
await connection.release();
|
|
380
|
+
}
|
|
381
|
+
```
|