@prisma-next/target-postgres 0.1.0-pr.72.2 → 0.2.0

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 (2) hide show
  1. package/README.md +8 -23
  2. package/package.json +12 -12
package/README.md CHANGED
@@ -17,8 +17,8 @@ Provides the Postgres target descriptor (`SqlControlTargetDescriptor`) for CLI c
17
17
  - **Target Descriptor Export**: Exports the Postgres `SqlControlTargetDescriptor` for use in CLI configuration files
18
18
  - **Descriptor-First Design**: All declarative fields (version, capabilities, types, operations) are properties directly on the descriptor, eliminating the need for separate manifest files
19
19
  - **Multi-Plane Support**: Provides both migration-plane (control) and runtime-plane entry points for the Postgres target
20
- - **Planner Factory**: Implements `migrations.createPlanner()` to create Postgres-specific migration planners
21
- - **Runner Factory**: Implements `migrations.createRunner()` to create Postgres-specific migration runners
20
+ - **Planner Factory**: Implements `createPlanner()` to create Postgres-specific migration planners
21
+ - **Runner Factory**: Implements `createRunner()` to create Postgres-specific migration runners
22
22
  - **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.
23
23
 
24
24
  This package spans multiple planes:
@@ -26,15 +26,6 @@ This package spans multiple planes:
26
26
  - **Runtime plane** (`src/exports/runtime.ts`): Runtime entry point for target-specific runtime code (future)
27
27
  - **Authoring pack ref** (`src/exports/pack.ts`): Pure data surface for contract builder workflows
28
28
 
29
- ## `db init`
30
-
31
- This package provides the Postgres implementation of the SQL migration planner/runner used by `prisma-next db init`:
32
-
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.
34
- - **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
-
36
- For the CLI orchestration, see `packages/1-framework/3-tooling/cli/src/commands/db-init.ts`.
37
-
38
29
  ## Usage
39
30
 
40
31
  ### Control Plane (CLI)
@@ -52,8 +43,8 @@ import postgresDriver from '@prisma-next/driver-postgres/control';
52
43
  // - id: 'postgres'
53
44
  // - version: '0.0.1'
54
45
  // - capabilities, types, operations (directly on descriptor)
55
- // - migrations.createPlanner(): creates a Postgres migration planner
56
- // - migrations.createRunner(): creates a Postgres migration runner
46
+ // - createPlanner(): creates a Postgres migration planner
47
+ // - createRunner(): creates a Postgres migration runner
57
48
 
58
49
  // Create family instance with target, adapter, and driver
59
50
  const family = sqlFamilyDescriptor.create({
@@ -63,23 +54,18 @@ const family = sqlFamilyDescriptor.create({
63
54
  extensions: [],
64
55
  });
65
56
 
66
- // Include the active framework components so planner/runner can resolve
67
- // component-owned database dependencies (e.g., extension installs).
68
- const frameworkComponents = [postgres, postgresAdapter];
69
-
70
57
  // Create planner and runner from target descriptor
71
- const planner = postgres.migrations.createPlanner(family);
72
- const runner = postgres.migrations.createRunner(family);
58
+ const planner = postgres.createPlanner(family);
59
+ const runner = postgres.createRunner(family);
73
60
 
74
61
  // Plan and execute migrations
75
- const planResult = planner.plan({ contract, schema, policy, frameworkComponents });
62
+ const planResult = planner.plan({ contract, schema, policy });
76
63
  if (planResult.kind === 'success') {
77
64
  const executeResult = await runner.execute({
78
65
  plan: planResult.plan,
79
66
  driver,
80
67
  destinationContract: contract,
81
68
  policy,
82
- frameworkComponents,
83
69
  });
84
70
  if (!executeResult.ok) {
85
71
  // Handle structured failure (e.g., EXECUTION_FAILED, PRECHECK_FAILED)
@@ -148,8 +134,7 @@ This package ships a mix of fast planner unit tests and slower runner integratio
148
134
 
149
135
  - **Default (`pnpm --filter @prisma-next/target-postgres test`)**: runs all tests including integration tests
150
136
  - **Test files**:
151
- - `test/migrations/planner.behavior.test.ts`: Planner unit tests (classification, conflicts, dependency ops)
152
- - `test/migrations/planner.integration.test.ts`: Planner integration tests
137
+ - `test/migrations/planner.case1.test.ts`: Planner unit tests
153
138
  - `test/migrations/runner.*.integration.test.ts`: Runner integration tests (basic, errors, idempotency, policy)
154
139
 
155
140
  ```bash
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@prisma-next/target-postgres",
3
- "version": "0.1.0-pr.72.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Postgres target pack for Prisma Next",
7
7
  "dependencies": {
8
8
  "arktype": "^2.0.0",
9
- "@prisma-next/family-sql": "0.1.0-pr.72.2",
10
- "@prisma-next/cli": "0.1.0-pr.72.2",
11
- "@prisma-next/contract": "0.1.0-pr.72.2",
12
- "@prisma-next/sql-contract": "0.1.0-pr.72.2",
13
- "@prisma-next/sql-errors": "0.1.0-pr.72.2",
14
- "@prisma-next/sql-schema-ir": "0.1.0-pr.72.2",
15
- "@prisma-next/core-control-plane": "0.1.0-pr.72.2",
16
- "@prisma-next/core-execution-plane": "0.1.0-pr.72.2",
17
- "@prisma-next/utils": "0.1.0-pr.72.2"
9
+ "@prisma-next/family-sql": "0.2.0",
10
+ "@prisma-next/cli": "0.2.0",
11
+ "@prisma-next/contract": "0.2.0",
12
+ "@prisma-next/sql-contract": "0.2.0",
13
+ "@prisma-next/sql-errors": "0.2.0",
14
+ "@prisma-next/sql-schema-ir": "0.2.0",
15
+ "@prisma-next/core-control-plane": "0.2.0",
16
+ "@prisma-next/core-execution-plane": "0.2.0",
17
+ "@prisma-next/utils": "0.2.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@vitest/coverage-v8": "^4.0.0",
@@ -22,8 +22,8 @@
22
22
  "tsup": "^8.3.0",
23
23
  "typescript": "^5.9.3",
24
24
  "vitest": "^4.0.16",
25
- "@prisma-next/adapter-postgres": "0.1.0-pr.72.2",
26
- "@prisma-next/driver-postgres": "0.1.0-pr.72.2",
25
+ "@prisma-next/adapter-postgres": "0.2.0",
26
+ "@prisma-next/driver-postgres": "0.2.0",
27
27
  "@prisma-next/test-utils": "0.0.1"
28
28
  },
29
29
  "files": [