@prisma/orm-postgres 8.0.0-rc.24-dev.28 → 8.0.0-rc.24-dev.29

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.
Files changed (55) hide show
  1. package/README.md +8 -3
  2. package/dist/components-CWcPJJxx-0zxP3brl.mjs +19 -0
  3. package/dist/components-CWcPJJxx-0zxP3brl.mjs.map +1 -0
  4. package/dist/config.mjs +21 -14
  5. package/dist/config.mjs.map +1 -1
  6. package/dist/{contract-from-json-BykLXhvn-QBZhmOB4.mjs → contract-from-json-BQdx9dk3-CHLY5fww.mjs} +3 -3
  7. package/dist/{contract-from-json-BykLXhvn-QBZhmOB4.mjs.map → contract-from-json-BQdx9dk3-CHLY5fww.mjs.map} +1 -1
  8. package/dist/contract-types.d.mts +4 -0
  9. package/dist/contract-types.mjs +1 -0
  10. package/dist/control.mjs +2 -8
  11. package/dist/control.mjs.map +1 -1
  12. package/dist/init-quick-reference-prisma7.md +80 -0
  13. package/dist/init-quick-reference.md +95 -0
  14. package/dist/init-readme.md +34 -0
  15. package/dist/init.d.mts +7 -0
  16. package/dist/init.d.mts.map +1 -0
  17. package/dist/init.mjs +272 -0
  18. package/dist/init.mjs.map +1 -0
  19. package/dist/internal__static-context.mjs +1 -1
  20. package/dist/internal__transaction-members.d.mts +1 -1
  21. package/dist/internal__transaction-members.mjs +1 -1
  22. package/dist/internal__validate-contract.mjs +1 -1
  23. package/dist/module-base-C02qpQ9x-BEyIGqx7.mjs +6 -0
  24. package/dist/module-base-C02qpQ9x-BEyIGqx7.mjs.map +1 -0
  25. package/dist/{postgres-members-B7ZvxGYc-D_L3NVGm.mjs → postgres-members-CRPX0rhb-C0keDjWe.mjs} +18 -16
  26. package/dist/postgres-members-CRPX0rhb-C0keDjWe.mjs.map +1 -0
  27. package/dist/{postgres-members-F9CVSrrN-BFAuNPbW.d.mts → postgres-members-DQvChDJ--ByodBWAn.d.mts} +3 -2
  28. package/dist/postgres-members-DQvChDJ--ByodBWAn.d.mts.map +1 -0
  29. package/dist/{postgres-static-P3V5EpAP-Df_jRCSf.mjs → postgres-static-BsLAA6GS-BBKjNHT8.mjs} +3 -3
  30. package/dist/{postgres-static-P3V5EpAP-Df_jRCSf.mjs.map → postgres-static-BsLAA6GS-BBKjNHT8.mjs.map} +1 -1
  31. package/dist/runtime.d.mts +1 -1
  32. package/dist/runtime.mjs +3 -3
  33. package/dist/runtime.mjs.map +1 -1
  34. package/dist/serverless.d.mts +1 -1
  35. package/dist/serverless.mjs +3 -3
  36. package/dist/serverless.mjs.map +1 -1
  37. package/dist/static.mjs +2 -2
  38. package/package.json +12 -10
  39. package/skills/prisma-8/SKILL.md +10 -10
  40. package/skills/prisma-8/references/build.md +12 -16
  41. package/skills/prisma-8/references/contract.md +35 -33
  42. package/skills/prisma-8/references/debug.md +5 -3
  43. package/skills/prisma-8/references/feedback.md +8 -8
  44. package/skills/prisma-8/references/migration-model.md +4 -0
  45. package/skills/prisma-8/references/migration-review.md +6 -5
  46. package/skills/prisma-8/references/migrations.md +73 -26
  47. package/skills/prisma-8/references/queries-mongo.md +3 -3
  48. package/skills/prisma-8/references/queries-postgres.md +25 -9
  49. package/skills/prisma-8/references/queries.md +9 -8
  50. package/skills/prisma-8/references/quickstart.md +19 -19
  51. package/skills/prisma-8/references/runtime.md +23 -23
  52. package/skills/prisma-8/references/supabase.md +7 -7
  53. package/skills/prisma-8/references/upgrade-app.md +1 -1
  54. package/dist/postgres-members-B7ZvxGYc-D_L3NVGm.mjs.map +0 -1
  55. package/dist/postgres-members-F9CVSrrN-BFAuNPbW.d.mts.map +0 -1
package/README.md CHANGED
@@ -3,17 +3,20 @@
3
3
  The one package a PostgreSQL application installs. It wires the framework, the SQL family, and the Postgres target into a single lazy client, and brings the rest of the stack along as exact-pinned dependencies:
4
4
 
5
5
  ```sh
6
- pnpm add @prisma/orm-postgres
6
+ pnpm add @prisma/orm-postgres pg
7
+ pnpm add -D @types/pg
7
8
  ```
8
9
 
9
10
  ```
10
11
  @prisma/orm-postgres
11
12
  ├── @prisma/orm-framework contracts, components, runtime core
12
13
  ├── @prisma/orm-family-sql SQL contract, lanes, ORM client, runtime
13
- ├── @prisma/orm-target-postgres target descriptor + adapter + pg driver
14
+ ├── @prisma/orm-target-postgres target descriptor + adapter + driver
14
15
  └── @prisma/orm-toolchain ORM command family for the `prisma` CLI, emitter, config loader
15
16
  ```
16
17
 
18
+ `pg` and `@types/pg` are peer dependencies: the driver is the application's, so a `pg.Pool` the application creates and the `pg` types Prisma 8 declares come from one copy. Prisma 8 supports `pg` 8.22.0 and later within major version 8.
19
+
17
20
  `temporal-polyfill` is a required peer dependency. The control plane, such as the `prisma` commands and the Vite plugin, loads it as a fallback `Temporal` when the runtime has none, and a project that already installs it for its own code has one copy. npm, pnpm and bun install it automatically; with Yarn, add `temporal-polyfill` to your dependencies.
18
21
 
19
22
  ## Entrypoints
@@ -24,11 +27,13 @@ pnpm add @prisma/orm-postgres
24
27
  | `/serverless` | the serverless runtime variant |
25
28
  | `/static` | statically composed runtime for pre-wired deployments |
26
29
  | `/config` | `defineConfig` for `prisma.config.ts` |
30
+ | `/contract-types` | the types a generated `contract.d.ts` imports |
27
31
  | `/contract-builder` | `defineContract`, Postgres enums, RLS authoring |
28
32
  | `/target`, `/family` | the Postgres target pack and the SQL family pack |
29
33
  | `/migration`, `/control` | migration planning and the control client |
34
+ | `/init` | the init contribution `prisma orm init` writes a project from |
30
35
 
31
- Generated contract files import their types from the facade, so an application never has to depend on a package it did not install:
36
+ A generated `contract.d.ts` imports every framework, family and target type it names from `/contract-types`, and a generated `migration.ts` imports from `/migration`: the modules this package's `defineConfig` sets as `contract.typesModule` and `migrations.module`. The facade also forwards the namespaces of the packages it is built from, so an application never has to depend on a package it did not install:
32
37
 
33
38
  | Namespace | Forwards |
34
39
  | --- | --- |
@@ -0,0 +1,19 @@
1
+ import { t as moduleBase } from "./module-base-C02qpQ9x-BEyIGqx7.mjs";
2
+ import postgresAdapter from "@prisma/orm-target-postgres/adapter/control";
3
+ import postgresDriver from "@prisma/orm-target-postgres/driver/control";
4
+ import sql from "@prisma/orm-family-sql/family/control";
5
+ import { restateTypeDeclarations } from "@prisma/orm-framework/target-package-config/type-declarations";
6
+ import postgres from "@prisma/orm-target-postgres/target/control";
7
+ //#region ../../../3-targets/postgres/9-facade/dist/components-CWcPJJxx.mjs
8
+ const contractTypesModule = `${moduleBase}/contract-types`;
9
+ const contractBuilderModule = `${moduleBase}/contract-builder`;
10
+ const controlComponents = {
11
+ family: sql,
12
+ target: restateTypeDeclarations(postgres, contractTypesModule),
13
+ adapter: restateTypeDeclarations(postgresAdapter, contractTypesModule),
14
+ driver: postgresDriver
15
+ };
16
+ //#endregion
17
+ export { contractTypesModule as n, controlComponents as r, contractBuilderModule as t };
18
+
19
+ //# sourceMappingURL=components-CWcPJJxx-0zxP3brl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-CWcPJJxx-0zxP3brl.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/components-CWcPJJxx.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-C02qpQ9x.mjs\";\nimport postgresAdapter from \"@internal/adapter-postgres/control\";\nimport postgresDriver from \"@internal/driver-postgres/control\";\nimport sql from \"@internal/family-sql/control\";\nimport { restateTypeDeclarations } from \"@internal/target-package-config/type-declarations\";\nimport postgres from \"@internal/target-postgres/control\";\n//#region src/config/components.ts\nconst contractTypesModule = `${moduleBase}/contract-types`;\nconst contractBuilderModule = `${moduleBase}/contract-builder`;\nconst controlComponents = {\n\tfamily: sql,\n\ttarget: restateTypeDeclarations(postgres, contractTypesModule),\n\tadapter: restateTypeDeclarations(postgresAdapter, contractTypesModule),\n\tdriver: postgresDriver\n};\n//#endregion\nexport { contractTypesModule as n, controlComponents as r, contractBuilderModule as t };\n\n//# sourceMappingURL=components-CWcPJJxx.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,sBAAsB,GAAG,WAAW;AAC1C,MAAM,wBAAwB,GAAG,WAAW;AAC5C,MAAM,oBAAoB;CACzB,QAAQ;CACR,QAAQ,wBAAwB,UAAU,mBAAmB;CAC7D,SAAS,wBAAwB,iBAAiB,mBAAmB;CACrE,QAAQ;AACT"}
package/dist/config.mjs CHANGED
@@ -1,11 +1,9 @@
1
- import postgresAdapter from "@prisma/orm-target-postgres/adapter/control";
1
+ import { t as moduleBase } from "./module-base-C02qpQ9x-BEyIGqx7.mjs";
2
+ import { n as contractTypesModule, r as controlComponents, t as contractBuilderModule } from "./components-CWcPJJxx-0zxP3brl.mjs";
2
3
  import { defaultContractOutputPath, defineConfig as defineConfig$1 } from "@prisma/orm-framework/config/config-types";
3
- import postgresDriver from "@prisma/orm-target-postgres/driver/control";
4
- import sql from "@prisma/orm-family-sql/family/control";
5
4
  import { prismaContract } from "@prisma/orm-family-sql/contract-psl/provider";
6
- import { typescriptContractFromPath } from "@prisma/orm-family-sql/contract-ts/config-types";
5
+ import { refuseOtherTargetOnLoad, typescriptContractFromPath } from "@prisma/orm-family-sql/contract-ts/config-types";
7
6
  import { PG_INT_CODEC_ID, PG_TEXT_CODEC_ID } from "@prisma/orm-target-postgres/target/codec-ids";
8
- import postgres from "@prisma/orm-target-postgres/target/control";
9
7
  import postgresPackRef from "@prisma/orm-target-postgres/target/pack";
10
8
  import { postgresCreateNamespace } from "@prisma/orm-target-postgres/target/types";
11
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -13,8 +11,12 @@ import { extname, join } from "pathe";
13
11
  import { prisma7Contract } from "@prisma/orm-family-sql/contract-prisma7/provider";
14
12
  import { prisma7PostgresBinding } from "@prisma/orm-target-postgres/target/prisma7-binding";
15
13
  //#region ../../../3-targets/postgres/9-facade/dist/config.mjs
14
+ const postgresContractTarget = {
15
+ target: postgresPackRef,
16
+ contractBuilderModule
17
+ };
16
18
  function contractConfigFromPath(contractPath, output) {
17
- return extname(contractPath) === ".ts" ? typescriptContractFromPath(contractPath, output) : prismaContract(contractPath, {
19
+ return extname(contractPath) === ".ts" ? typescriptContractFromPath(contractPath, output, postgresContractTarget) : prismaContract(contractPath, {
18
20
  output,
19
21
  target: postgresPackRef,
20
22
  createNamespace: postgresCreateNamespace,
@@ -30,20 +32,25 @@ function resolveContractConfig(options) {
30
32
  const firstInput = options.contract.source.inputs?.[0];
31
33
  const output = explicitOutput ?? options.contract.output ?? (firstInput !== void 0 ? defaultContractOutputPath(firstInput) : void 0);
32
34
  return {
33
- ...options.contract,
35
+ ...refuseOtherTargetOnLoad(options.contract, postgresContractTarget),
34
36
  ...ifDefined("output", output)
35
37
  };
36
38
  }
37
39
  function defineConfig(options) {
40
+ const extensions = options.extensions ?? [];
41
+ const contractConfig = resolveContractConfig(options);
38
42
  return defineConfig$1({
39
- family: sql,
40
- target: postgres,
41
- adapter: postgresAdapter,
42
- driver: postgresDriver,
43
- extensions: options.extensions ?? [],
44
- contract: resolveContractConfig(options),
43
+ ...controlComponents,
44
+ extensions,
45
+ contract: {
46
+ ...contractConfig,
47
+ typesModule: contractTypesModule
48
+ },
49
+ migrations: {
50
+ ...options.migrations,
51
+ module: `${moduleBase}/migration`
52
+ },
45
53
  ...ifDefined("db", options.db),
46
- ...ifDefined("migrations", options.migrations),
47
54
  ...ifDefined("formatter", options.formatter)
48
55
  });
49
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/config.mjs"],"sourcesContent":["import postgresAdapter from \"@internal/adapter-postgres/control\";\nimport { defaultContractOutputPath, defineConfig as defineConfig$1 } from \"@internal/config/config-types\";\nimport postgresDriver from \"@internal/driver-postgres/control\";\nimport sql from \"@internal/family-sql/control\";\nimport { prismaContract } from \"@internal/sql-contract-psl/provider\";\nimport { typescriptContractFromPath } from \"@internal/sql-contract-ts/config-types\";\nimport { PG_INT_CODEC_ID, PG_TEXT_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport postgres from \"@internal/target-postgres/control\";\nimport postgresPackRef from \"@internal/target-postgres/pack\";\nimport { postgresCreateNamespace } from \"@internal/target-postgres/types\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { extname, join } from \"pathe\";\nimport { prisma7Contract } from \"@internal/sql-contract-prisma7/provider\";\nimport { prisma7PostgresBinding } from \"@internal/target-postgres/prisma7-binding\";\n//#region src/config/define-config.ts\nfunction contractConfigFromPath(contractPath, output) {\n\treturn extname(contractPath) === \".ts\" ? typescriptContractFromPath(contractPath, output) : prismaContract(contractPath, {\n\t\toutput,\n\t\ttarget: postgresPackRef,\n\t\tcreateNamespace: postgresCreateNamespace,\n\t\tenumInferenceCodecs: {\n\t\t\ttext: PG_TEXT_CODEC_ID,\n\t\t\tint: PG_INT_CODEC_ID\n\t\t}\n\t});\n}\nfunction resolveContractConfig(options) {\n\tconst explicitOutput = options.output !== void 0 ? join(options.output, \"contract.json\") : void 0;\n\tif (typeof options.contract === \"string\") return contractConfigFromPath(options.contract, explicitOutput ?? defaultContractOutputPath(options.contract));\n\tconst firstInput = options.contract.source.inputs?.[0];\n\tconst output = explicitOutput ?? options.contract.output ?? (firstInput !== void 0 ? defaultContractOutputPath(firstInput) : void 0);\n\treturn {\n\t\t...options.contract,\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction defineConfig(options) {\n\treturn defineConfig$1({\n\t\tfamily: sql,\n\t\ttarget: postgres,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? [],\n\t\tcontract: resolveContractConfig(options),\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"migrations\", options.migrations),\n\t\t...ifDefined(\"formatter\", options.formatter)\n\t});\n}\n//#endregion\n//#region src/config/prisma7-schema.ts\n/**\n* Reads a Prisma 7 `schema.prisma` (or a directory of `.prisma` files) as the\n* contract source, so Prisma 8 can adopt a database Prisma 7 still migrates.\n*/\nfunction prisma7Schema(schemaPath) {\n\treturn prisma7Contract(schemaPath, { binding: prisma7PostgresBinding });\n}\n//#endregion\nexport { defineConfig, prisma7Schema };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,uBAAuB,cAAc,QAAQ;CACrD,OAAO,QAAQ,YAAY,MAAM,QAAQ,2BAA2B,cAAc,MAAM,IAAI,eAAe,cAAc;EACxH;EACA,QAAQ;EACR,iBAAiB;EACjB,qBAAqB;GACpB,MAAM;GACN,KAAK;EACN;CACD,CAAC;AACF;AACA,SAAS,sBAAsB,SAAS;CACvC,MAAM,iBAAiB,QAAQ,WAAW,KAAK,IAAI,KAAK,QAAQ,QAAQ,eAAe,IAAI,KAAK;CAChG,IAAI,OAAO,QAAQ,aAAa,UAAU,OAAO,uBAAuB,QAAQ,UAAU,kBAAkB,0BAA0B,QAAQ,QAAQ,CAAC;CACvJ,MAAM,aAAa,QAAQ,SAAS,OAAO,SAAS;CACpD,MAAM,SAAS,kBAAkB,QAAQ,SAAS,WAAW,eAAe,KAAK,IAAI,0BAA0B,UAAU,IAAI,KAAK;CAClI,OAAO;EACN,GAAG,QAAQ;EACX,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,aAAa,SAAS;CAC9B,OAAO,eAAe;EACrB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,QAAQ,cAAc,CAAC;EACnC,UAAU,sBAAsB,OAAO;EACvC,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,aAAa,QAAQ,SAAS;CAC5C,CAAC;AACF;;;;;AAOA,SAAS,cAAc,YAAY;CAClC,OAAO,gBAAgB,YAAY,EAAE,SAAS,uBAAuB,CAAC;AACvE"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/config.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-C02qpQ9x.mjs\";\nimport { n as contractTypesModule, r as controlComponents, t as contractBuilderModule } from \"./components-CWcPJJxx.mjs\";\nimport { defaultContractOutputPath, defineConfig as defineConfig$1 } from \"@internal/config/config-types\";\nimport { prismaContract } from \"@internal/sql-contract-psl/provider\";\nimport { refuseOtherTargetOnLoad, typescriptContractFromPath } from \"@internal/sql-contract-ts/config-types\";\nimport { PG_INT_CODEC_ID, PG_TEXT_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport postgresPackRef from \"@internal/target-postgres/pack\";\nimport { postgresCreateNamespace } from \"@internal/target-postgres/types\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { extname, join } from \"pathe\";\nimport { prisma7Contract } from \"@internal/sql-contract-prisma7/provider\";\nimport { prisma7PostgresBinding } from \"@internal/target-postgres/prisma7-binding\";\n//#region src/config/define-config.ts\nconst postgresContractTarget = {\n\ttarget: postgresPackRef,\n\tcontractBuilderModule\n};\nfunction contractConfigFromPath(contractPath, output) {\n\treturn extname(contractPath) === \".ts\" ? typescriptContractFromPath(contractPath, output, postgresContractTarget) : prismaContract(contractPath, {\n\t\toutput,\n\t\ttarget: postgresPackRef,\n\t\tcreateNamespace: postgresCreateNamespace,\n\t\tenumInferenceCodecs: {\n\t\t\ttext: PG_TEXT_CODEC_ID,\n\t\t\tint: PG_INT_CODEC_ID\n\t\t}\n\t});\n}\nfunction resolveContractConfig(options) {\n\tconst explicitOutput = options.output !== void 0 ? join(options.output, \"contract.json\") : void 0;\n\tif (typeof options.contract === \"string\") return contractConfigFromPath(options.contract, explicitOutput ?? defaultContractOutputPath(options.contract));\n\tconst firstInput = options.contract.source.inputs?.[0];\n\tconst output = explicitOutput ?? options.contract.output ?? (firstInput !== void 0 ? defaultContractOutputPath(firstInput) : void 0);\n\treturn {\n\t\t...refuseOtherTargetOnLoad(options.contract, postgresContractTarget),\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction defineConfig(options) {\n\tconst extensions = options.extensions ?? [];\n\tconst contractConfig = resolveContractConfig(options);\n\treturn defineConfig$1({\n\t\t...controlComponents,\n\t\textensions,\n\t\tcontract: {\n\t\t\t...contractConfig,\n\t\t\ttypesModule: contractTypesModule\n\t\t},\n\t\tmigrations: {\n\t\t\t...options.migrations,\n\t\t\tmodule: `${moduleBase}/migration`\n\t\t},\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"formatter\", options.formatter)\n\t});\n}\n//#endregion\n//#region src/config/prisma7-schema.ts\n/**\n* Reads a Prisma 7 `schema.prisma` (or a directory of `.prisma` files) as the\n* contract source, so Prisma 8 can adopt a database Prisma 7 still migrates.\n*/\nfunction prisma7Schema(schemaPath) {\n\treturn prisma7Contract(schemaPath, { binding: prisma7PostgresBinding });\n}\n//#endregion\nexport { defineConfig, prisma7Schema };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,yBAAyB;CAC9B,QAAQ;CACR;AACD;AACA,SAAS,uBAAuB,cAAc,QAAQ;CACrD,OAAO,QAAQ,YAAY,MAAM,QAAQ,2BAA2B,cAAc,QAAQ,sBAAsB,IAAI,eAAe,cAAc;EAChJ;EACA,QAAQ;EACR,iBAAiB;EACjB,qBAAqB;GACpB,MAAM;GACN,KAAK;EACN;CACD,CAAC;AACF;AACA,SAAS,sBAAsB,SAAS;CACvC,MAAM,iBAAiB,QAAQ,WAAW,KAAK,IAAI,KAAK,QAAQ,QAAQ,eAAe,IAAI,KAAK;CAChG,IAAI,OAAO,QAAQ,aAAa,UAAU,OAAO,uBAAuB,QAAQ,UAAU,kBAAkB,0BAA0B,QAAQ,QAAQ,CAAC;CACvJ,MAAM,aAAa,QAAQ,SAAS,OAAO,SAAS;CACpD,MAAM,SAAS,kBAAkB,QAAQ,SAAS,WAAW,eAAe,KAAK,IAAI,0BAA0B,UAAU,IAAI,KAAK;CAClI,OAAO;EACN,GAAG,wBAAwB,QAAQ,UAAU,sBAAsB;EACnE,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,aAAa,SAAS;CAC9B,MAAM,aAAa,QAAQ,cAAc,CAAC;CAC1C,MAAM,iBAAiB,sBAAsB,OAAO;CACpD,OAAO,eAAe;EACrB,GAAG;EACH;EACA,UAAU;GACT,GAAG;GACH,aAAa;EACd;EACA,YAAY;GACX,GAAG,QAAQ;GACX,QAAQ,GAAG,WAAW;EACvB;EACA,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,aAAa,QAAQ,SAAS;CAC5C,CAAC;AACF;;;;;AAOA,SAAS,cAAc,YAAY;CAClC,OAAO,gBAAgB,YAAY,EAAE,SAAS,uBAAuB,CAAC;AACvE"}
@@ -1,7 +1,7 @@
1
1
  import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
2
2
  import { validateContractOnce } from "@prisma/orm-framework/contract/validate-once";
3
- //#region ../../../3-targets/postgres/9-facade/dist/contract-from-json-BykLXhvn.mjs
4
- var version = "8.0.0-rc.24-dev.28";
3
+ //#region ../../../3-targets/postgres/9-facade/dist/contract-from-json-BQdx9dk3.mjs
4
+ var version = "8.0.0-rc.24-dev.29";
5
5
  const serializer = new PostgresContractSerializer();
6
6
  const validator = `${postgresTarget.targetId}@${version}`;
7
7
  /**
@@ -30,4 +30,4 @@ function validatePostgresContract(contract) {
30
30
  //#endregion
31
31
  export { validatePostgresContract as n, contractFromJson as t };
32
32
 
33
- //# sourceMappingURL=contract-from-json-BykLXhvn-QBZhmOB4.mjs.map
33
+ //# sourceMappingURL=contract-from-json-BQdx9dk3-CHLY5fww.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-from-json-BykLXhvn-QBZhmOB4.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/contract-from-json-BykLXhvn.mjs"],"sourcesContent":["import postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\n//#region package.json\nvar version = \"8.0.0-rc.24-dev.28\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new PostgresContractSerializer();\nconst validator = `${postgresTarget.targetId}@${version}`;\n/**\n* Validates an emitted Postgres `contract.json` and returns it as the contract type the\n* application names, ready to pass to `postgres({ contract })` and the other Postgres clients.\n* Clients built from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\n/** Validates a contract value for a Postgres client, once per value. */\nfunction validatePostgresContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\nexport { validatePostgresContract as n, contractFromJson as t };\n\n//# sourceMappingURL=contract-from-json-BykLXhvn.mjs.map"],"mappings":";;;AAGA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,2BAA2B;AAClD,MAAM,YAAY,GAAG,eAAe,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBhD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,yBAAyB,UAAU;CAC3C,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H"}
1
+ {"version":3,"file":"contract-from-json-BQdx9dk3-CHLY5fww.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/contract-from-json-BQdx9dk3.mjs"],"sourcesContent":["import postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\n//#region package.json\nvar version = \"8.0.0-rc.24-dev.29\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new PostgresContractSerializer();\nconst validator = `${postgresTarget.targetId}@${version}`;\n/**\n* Validates an emitted Postgres `contract.json` and returns it as the contract type the\n* application names, ready to pass to `postgres({ contract })` and the other Postgres clients.\n* Clients built from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\n/** Validates a contract value for a Postgres client, once per value. */\nfunction validatePostgresContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\nexport { validatePostgresContract as n, contractFromJson as t };\n\n//# sourceMappingURL=contract-from-json-BQdx9dk3.mjs.map"],"mappings":";;;AAGA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,2BAA2B;AAClD,MAAM,YAAY,GAAG,eAAe,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBhD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,yBAAyB,UAAU;CAC3C,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H"}
@@ -0,0 +1,4 @@
1
+ export * from "@prisma/orm-framework/contract/types";
2
+ export * from "@prisma/orm-family-sql/contract/types";
3
+ export * from "@prisma/orm-target-postgres/target/codec-types";
4
+ export * from "@prisma/orm-target-postgres/target/operation-types";
@@ -0,0 +1 @@
1
+ export {};
package/dist/control.mjs CHANGED
@@ -1,7 +1,4 @@
1
- import postgresAdapter from "@prisma/orm-target-postgres/adapter/control";
2
- import postgresDriver from "@prisma/orm-target-postgres/driver/control";
3
- import sql from "@prisma/orm-family-sql/family/control";
4
- import postgres from "@prisma/orm-target-postgres/target/control";
1
+ import { r as controlComponents } from "./components-CWcPJJxx-0zxP3brl.mjs";
5
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
3
  import { createControlClient } from "@prisma/orm-toolchain/cli/control-api";
7
4
  //#region ../../../3-targets/postgres/9-facade/dist/control.mjs
@@ -15,10 +12,7 @@ import { createControlClient } from "@prisma/orm-toolchain/cli/control-api";
15
12
  */
16
13
  function createPostgresControlClient(options = {}) {
17
14
  return createControlClient({
18
- family: sql,
19
- target: postgres,
20
- adapter: postgresAdapter,
21
- driver: postgresDriver,
15
+ ...controlComponents,
22
16
  ...ifDefined("connection", options.connection),
23
17
  ...ifDefined("extensions", options.extensions)
24
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/control.mjs"],"sourcesContent":["import postgresAdapter from \"@internal/adapter-postgres/control\";\nimport postgresDriver from \"@internal/driver-postgres/control\";\nimport sql from \"@internal/family-sql/control\";\nimport postgres from \"@internal/target-postgres/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { createControlClient } from \"@internal/cli/control-api\";\n//#region src/exports/control.ts\n/**\n* Control-API facade for Postgres.\n*\n* Collapses the five-package wiring required to drive control-side\n* operations (`dbInit`, `dbUpdate`, `dbVerify`, `migrate`, …) into\n* a single `createPostgresControlClient()` call. Mirrors what\n* `@internal/postgres/runtime` did for the query side.\n*/\nfunction createPostgresControlClient(options = {}) {\n\treturn createControlClient({\n\t\tfamily: sql,\n\t\ttarget: postgres,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\t...ifDefined(\"connection\", options.connection),\n\t\t...ifDefined(\"extensions\", options.extensions)\n\t});\n}\n//#endregion\nexport { createPostgresControlClient };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,4BAA4B,UAAU,CAAC,GAAG;CAClD,OAAO,oBAAoB;EAC1B,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,cAAc,QAAQ,UAAU;CAC9C,CAAC;AACF"}
1
+ {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/control.mjs"],"sourcesContent":["import { r as controlComponents } from \"./components-CWcPJJxx.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { createControlClient } from \"@internal/cli/control-api\";\n//#region src/exports/control.ts\n/**\n* Control-API facade for Postgres.\n*\n* Collapses the five-package wiring required to drive control-side\n* operations (`dbInit`, `dbUpdate`, `dbVerify`, `migrate`, …) into\n* a single `createPostgresControlClient()` call. Mirrors what\n* `@internal/postgres/runtime` did for the query side.\n*/\nfunction createPostgresControlClient(options = {}) {\n\treturn createControlClient({\n\t\t...controlComponents,\n\t\t...ifDefined(\"connection\", options.connection),\n\t\t...ifDefined(\"extensions\", options.extensions)\n\t});\n}\n//#endregion\nexport { createPostgresControlClient };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,4BAA4B,UAAU,CAAC,GAAG;CAClD,OAAO,oBAAoB;EAC1B,GAAG;EACH,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,cAAc,QAAQ,UAAU;CAC9C,CAAC;AACF"}
@@ -0,0 +1,80 @@
1
+ # Welcome to Prisma ORM 8!
2
+
3
+ Prisma ORM lets you query your database in simple, easy-to-read TypeScript. This project keeps its Prisma 7 schema and migrations, and Prisma 8 reads that schema as its contract source, so both run side by side while you move your code over.
4
+
5
+ {{requirements}}
6
+
7
+ ## Your contract source
8
+
9
+ Your contract source is your Prisma 7 schema at [`{{schemaPath}}`]({{schemaPath}}). Prisma 7 keeps owning it: edit it as before and migrate with `prisma7 migrate dev`. Prisma 8 compiles it into two companion files under `{{outputDir}}/`:
10
+
11
+ - **`contract.json`** — this tells your application what models exist, just like `package-lock.json` tells your package manager what dependencies your project has
12
+ - **`contract.d.ts`** — this powers autocomplete and type checking in your editor
13
+
14
+ Commit both files to git. When the schema changes, run `{{pkgRun}} contract emit` to update them.
15
+
16
+ Every model in your schema can be queried from your app through the Prisma 8 client:
17
+
18
+ ```typescript
19
+ import { db } from '{{dbImportPath}}';
20
+
21
+ const user = await db.orm.public.User
22
+ .where({ email: 'alice@example.com' })
23
+ .first();
24
+ ```
25
+
26
+ ## Configuration
27
+
28
+ [`prisma.config.ts`](prisma.config.ts) tells the Prisma 8 CLI where your contract source lives and how to connect to your database.{{prisma7ConfigSentence}}
29
+
30
+ ```typescript
31
+ import 'dotenv/config';
32
+ import { definePrismaConfig } from '@prisma/cli-engine';
33
+ import { defineConfig as ormConfig, prisma7Schema } from '{{configEntrypoint}}';
34
+
35
+ export default definePrismaConfig({
36
+ orm: ormConfig({
37
+ contract: prisma7Schema('{{schemaPath}}'),
38
+ output: '{{outputDir}}',
39
+ db: {
40
+ connection: process.env['DATABASE_URL']!,
41
+ },
42
+ }),
43
+ });
44
+ ```
45
+
46
+ `DATABASE_URL` is read from your [`.env`](./.env) file:
47
+
48
+ ```env
49
+ DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
50
+ ```
51
+
52
+ ## The transition loop
53
+
54
+ 1. Run `{{pkgRun}} db sign` once so Prisma 8 knows the database matches the contract.
55
+ 2. Move your routes to the Prisma 8 client in [`{{outputDir}}/db.ts`]({{outputDir}}/db.ts) one at a time.
56
+ 3. After each `prisma7 migrate dev`, run `{{pkgRun}} contract emit` and then `{{pkgRun}} db sign`.
57
+
58
+ ## Quick reference
59
+
60
+ ### Commands
61
+
62
+ ```bash
63
+ {{pkgRun}} contract emit # Update contract.json and contract.d.ts from the schema
64
+ {{pkgRun}} db sign # Record that the database matches the contract
65
+ prisma7 migrate dev # Migrate with Prisma 7, as before
66
+ ```
67
+
68
+ ### Files
69
+
70
+ | File | Purpose |
71
+ |---|---|
72
+ | [`{{schemaPath}}`]({{schemaPath}}) | Your Prisma 7 schema — the contract source |
73
+ | [`prisma.config.ts`](prisma.config.ts) | Prisma 8 CLI configuration |{{prisma7ConfigRow}}
74
+ | [`{{outputDir}}/db.ts`]({{outputDir}}/db.ts) | Database client — `import { db } from '{{dbImportPath}}'` |
75
+ | `{{outputDir}}/contract.json` | Compiled contract (generated) |
76
+ | `{{outputDir}}/contract.d.ts` | Contract types (generated) |
77
+
78
+ ## Monorepo notes (pnpm workspaces)
79
+
80
+ If this project lives inside a pnpm workspace, `pnpm-workspace.yaml` catalogs for `prisma` or `{{pkg}}` take precedence over `latest`; update or remove the catalog entry and re-run `pnpm install` if you wanted the published version.
@@ -0,0 +1,95 @@
1
+ # Welcome to Prisma ORM!
2
+
3
+ Prisma ORM lets you query your database in simple, easy-to-read TypeScript. Define what your data looks like, and Prisma ORM gives you a fully typed client — with autocomplete for every table, column, and relation.
4
+
5
+ This project is set up for PostgreSQL. Prisma ORM also supports other databases.
6
+
7
+ {{requirements}}
8
+
9
+ ## Your data contract
10
+
11
+ Your data contract is the heart of your application. It lives at [`{{schemaPath}}`]({{schemaPath}}) and describes your models:
12
+
13
+ {{schemaSample}}
14
+
15
+ Every model you define in your contract can be queried from your app. Your editor will autocomplete the query methods and show you what type each model field is:
16
+
17
+ ```typescript
18
+ import { db } from '{{dbImportPath}}';
19
+
20
+ const user = await db.orm.public.User
21
+ .where({ email: 'alice@example.com' })
22
+ .first();
23
+
24
+ // Your editor will show the type of user as
25
+ // { id: number; email: string; username: string | null; name: string | null; createdAt: Date; posts: Post[] } | null
26
+ ```
27
+
28
+ Your contract has two companion files in the same directory:
29
+
30
+ - **`contract.json`** — this tells your application what models exist, just like `package-lock.json` tells your package manager what dependencies your project has
31
+ - **`contract.d.ts`** — this powers autocomplete and type checking in your editor
32
+
33
+ Commit both files to git. When you change your contract, run `{{pkgRun}} contract emit` to update them.
34
+
35
+ If you use a framework like Next.js or Vite, the Prisma ORM plugin will do this for you automatically.
36
+
37
+ ## Configuration
38
+
39
+ [`prisma.config.ts`](prisma.config.ts) tells the CLI where your contract lives and how to connect to your database. It loads environment variables from `.env` automatically:
40
+
41
+ ```typescript
42
+ import 'dotenv/config';
43
+ import { definePrismaConfig } from '@prisma/cli-engine';
44
+ import { defineConfig as ormConfig } from '{{configEntrypoint}}';
45
+
46
+ export default definePrismaConfig({
47
+ orm: ormConfig({
48
+ contract: './{{schemaPath}}',
49
+ db: {
50
+ connection: process.env['DATABASE_URL']!,
51
+ },
52
+ }),
53
+ });
54
+ ```
55
+
56
+ Notice the `DATABASE_URL` above? It's defined in your [`.env`](./.env) file:
57
+
58
+ ```env
59
+ DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
60
+ ```
61
+
62
+ You can customize how your environment variables are loaded by changing or removing the `import 'dotenv/config'` line.
63
+
64
+ ## Quick reference
65
+
66
+ ### Commands
67
+
68
+ ```bash
69
+ {{pkgRun}} contract emit # Update contract.json and contract.d.ts
70
+ {{pkgRun}} db init # Create tables in the database
71
+ {{pkgRun}} migration status # Show migration status
72
+ ```
73
+
74
+ ### Files
75
+
76
+ | File | Purpose |
77
+ |---|---|
78
+ | [`{{schemaPath}}`]({{schemaPath}}) | Your data contract — define your models here |
79
+ | [`prisma.config.ts`](prisma.config.ts) | CLI configuration |
80
+ | [`{{schemaDir}}/db.ts`]({{schemaDir}}/db.ts) | Database client — `import { db } from '{{dbImportPath}}'` |
81
+ | `{{schemaDir}}/contract.json` | Compiled contract (generated) |
82
+ | `{{schemaDir}}/contract.d.ts` | Contract types (generated) |
83
+
84
+ ### Workflow
85
+
86
+ 1. Edit [`{{schemaPath}}`]({{schemaPath}}) to add or change models.
87
+ 2. Run `{{pkgRun}} contract emit` to regenerate the contract.
88
+ 3. Query your models — your IDE will autocomplete everything.
89
+
90
+ ## Monorepo notes (pnpm workspaces)
91
+
92
+ If this project lives inside a pnpm workspace, a few things are worth knowing:
93
+
94
+ - **Catalogs.** When the workspace's `pnpm-workspace.yaml` defines a `catalogs` entry for `prisma` or `{{pkg}}`, pnpm uses the catalog version everywhere — `init` does too. If you wanted the published `latest` instead, update or remove the catalog entry, then re-run `pnpm install`.
95
+ - **`pnpm dlx`.** `pnpm dlx prisma@latest orm init …` works in any directory. Inside a workspace, pnpm still resolves dependencies through the workspace's catalog/overrides rather than the registry; expect the installed Prisma ORM packages to reflect the workspace's catalog rather than `latest`.
@@ -0,0 +1,34 @@
1
+ # {{projectName}}
2
+
3
+ Generated by `prisma orm init` with the Minimal template.
4
+
5
+ ## First run
6
+
7
+ 1. `{{runDbInit}}` — applies your contract to the database (creates tables, signs the marker).
8
+ 2. `{{runDev}}` — runs `src/index.ts`, which writes one row and reads it back.
9
+
10
+ ## Available scripts
11
+
12
+ - `{{runDev}}` — run the Prisma ORM sample script
13
+
14
+ ### Database and migrations
15
+
16
+ - `{{runContractEmit}}` — emit contract artifacts after contract changes
17
+ - `{{runDbInit}}` — initialize database state manually
18
+ - `{{runDbUpdate}}` — update database state manually
19
+ - `{{runMigrationPlan}}` — create a migration plan
20
+ - `{{runMigrate}}` — apply a planned migration
21
+ - `{{runDbSeed}}` — insert sample users manually (run after `db:init`)
22
+
23
+ ## Prisma ORM
24
+
25
+ Prisma ORM setup is scaffolded in:
26
+
27
+ - `{{contractPath}}`
28
+ - `prisma.config.ts`
29
+ - `prisma/db.ts`
30
+ - `src/lib/prisma.ts`
31
+
32
+ For provider-specific Prisma ORM reference docs, see `prisma-8.md`. Prisma ORM skills live in the upstream `skills/` directory: https://github.com/prisma/prisma/tree/main/skills.
33
+
34
+ Node-based Prisma ORM projects expect Node.js 24 LTS or newer.
@@ -0,0 +1,7 @@
1
+ import { InitContribution } from "@prisma/orm-toolchain/cli/init-contribution";
2
+ //#region ../../../3-targets/postgres/9-facade/dist/init.d.mts
3
+ //#region src/init/init-contribution.d.ts
4
+ declare const contribution: InitContribution;
5
+ //#endregion
6
+ export { contribution as default };
7
+ //# sourceMappingURL=init.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/init.d.mts"],"mappings":";;;cAEc,cAAc"}