@prisma-next/target-postgres 0.3.0-dev.33 → 0.3.0-dev.36

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 (44) hide show
  1. package/README.md +5 -1
  2. package/dist/control.d.mts +16 -0
  3. package/dist/control.d.mts.map +1 -0
  4. package/dist/control.mjs +2453 -0
  5. package/dist/control.mjs.map +1 -0
  6. package/dist/descriptor-meta-DxB8oZzB.mjs +13 -0
  7. package/dist/descriptor-meta-DxB8oZzB.mjs.map +1 -0
  8. package/dist/pack.d.mts +7 -0
  9. package/dist/pack.d.mts.map +1 -0
  10. package/dist/pack.mjs +9 -0
  11. package/dist/pack.mjs.map +1 -0
  12. package/dist/runtime.d.mts +9 -0
  13. package/dist/runtime.d.mts.map +1 -0
  14. package/dist/runtime.mjs +21 -0
  15. package/dist/runtime.mjs.map +1 -0
  16. package/package.json +28 -28
  17. package/src/core/migrations/planner.ts +172 -22
  18. package/src/core/migrations/runner.ts +27 -20
  19. package/src/core/migrations/statement-builders.ts +6 -6
  20. package/src/core/types.ts +5 -0
  21. package/src/exports/control.ts +1 -3
  22. package/src/exports/runtime.ts +7 -12
  23. package/dist/chunk-RKEXRSSI.js +0 -14
  24. package/dist/chunk-RKEXRSSI.js.map +0 -1
  25. package/dist/core/descriptor-meta.d.ts +0 -9
  26. package/dist/core/descriptor-meta.d.ts.map +0 -1
  27. package/dist/core/migrations/planner.d.ts +0 -14
  28. package/dist/core/migrations/planner.d.ts.map +0 -1
  29. package/dist/core/migrations/runner.d.ts +0 -8
  30. package/dist/core/migrations/runner.d.ts.map +0 -1
  31. package/dist/core/migrations/statement-builders.d.ts +0 -30
  32. package/dist/core/migrations/statement-builders.d.ts.map +0 -1
  33. package/dist/exports/control.d.ts +0 -8
  34. package/dist/exports/control.d.ts.map +0 -1
  35. package/dist/exports/control.js +0 -1260
  36. package/dist/exports/control.js.map +0 -1
  37. package/dist/exports/pack.d.ts +0 -4
  38. package/dist/exports/pack.d.ts.map +0 -1
  39. package/dist/exports/pack.js +0 -11
  40. package/dist/exports/pack.js.map +0 -1
  41. package/dist/exports/runtime.d.ts +0 -12
  42. package/dist/exports/runtime.d.ts.map +0 -1
  43. package/dist/exports/runtime.js +0 -19
  44. package/dist/exports/runtime.js.map +0 -1
package/README.md CHANGED
@@ -19,7 +19,11 @@ Provides the Postgres target descriptor (`SqlControlTargetDescriptor`) for CLI c
19
19
  - **Multi-Plane Support**: Provides both migration-plane (control) and runtime-plane entry points for the Postgres target
20
20
  - **Planner Factory**: Implements `migrations.createPlanner()` to create Postgres-specific migration planners
21
21
  - **Runner Factory**: Implements `migrations.createRunner()` to create Postgres-specific migration runners
22
+ - **Schema Verification Normalization**: Normalizes Postgres default expressions (for example, `nextval(...)`, `now()`) when verifying the post-apply schema
23
+ - **Postgres-Only Contract Extensions**: Defines Postgres-specific column defaults (e.g., sequences) used by the migration planner
24
+ - **Generated Defaults Policy**: Treats client-generated defaults as non-DB defaults when emitting DDL
22
25
  - **Database Dependency Consumption**: The planner extracts database dependencies from the configured framework components (passed as `frameworkComponents`), verifies each dependency against the live schema, and only emits install operations when required. The runner reuses the same metadata for post-apply verification, so there are no hardcoded extension mappings—database dependencies stay component-owned.
26
+ - **Storage Type Planning**: The planner dispatches storage type hooks for `storage.types` and emits type operations before table creation when supported by the policy
23
27
 
24
28
  This package spans multiple planes:
25
29
  - **Migration plane** (`src/exports/control.ts`): Control plane entry point that exports `SqlControlTargetDescriptor` for config files
@@ -30,7 +34,7 @@ This package spans multiple planes:
30
34
 
31
35
  This package provides the Postgres implementation of the SQL migration planner/runner used by `prisma-next db init`:
32
36
 
33
- - **Planner** (`src/core/migrations/planner.ts`): produces an additive-only `MigrationPlan` to bring the database schema in line with a destination contract. Extra unrelated schema is tolerated; non-additive mismatches (type/nullability/constraint incompatibilities) surface as structured conflicts.
37
+ - **Planner** (`src/core/migrations/planner.ts`): produces an additive-only `MigrationPlan` to bring the database schema in line with a destination contract. Extra unrelated schema is tolerated; non-additive mismatches (type/nullability/constraint incompatibilities) surface as structured conflicts. Storage type operations (from codec-owned hooks) are emitted before table operations when `storage.types` are present.
34
38
  - **Runner** (`src/core/migrations/runner.ts`): executes a plan under an advisory lock, verifies the post-state schema, then writes the contract marker and appends a ledger entry in the `prisma_contract` schema.
35
39
 
36
40
  For the CLI orchestration, see `packages/1-framework/3-tooling/cli/src/commands/db-init.ts`.
@@ -0,0 +1,16 @@
1
+ import { SqlControlTargetDescriptor } from "@prisma-next/family-sql/control";
2
+
3
+ //#region src/core/migrations/planner.d.ts
4
+ type OperationClass = 'extension' | 'type' | 'table' | 'unique' | 'index' | 'foreignKey';
5
+ interface PostgresPlanTargetDetails {
6
+ readonly schema: string;
7
+ readonly objectType: OperationClass;
8
+ readonly name: string;
9
+ readonly table?: string;
10
+ }
11
+ //#endregion
12
+ //#region src/exports/control.d.ts
13
+ declare const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresPlanTargetDetails>;
14
+ //#endregion
15
+ export { postgresTargetDescriptor as default };
16
+ //# sourceMappingURL=control.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/migrations/planner.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;KAuCK,cAAA;UAuBY,yBAAA;EAvBZ,SAAA,MAAA,EAAc,MAAA;EAuBF,SAAA,UAAA,EAEM,cAFmB;;;;;;cChDpC,0BAA0B,uCAAuC"}