@prisma-next/cli 0.16.0-dev.3 → 0.16.0-dev.31
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/README.md +44 -45
- package/dist/cli.mjs +13 -13
- package/dist/{client-KuBQftxz.mjs → client-B1UjQc_x.mjs} +50 -58
- package/dist/client-B1UjQc_x.mjs.map +1 -0
- package/dist/{command-helpers-Cpq44aVa.mjs → command-helpers-D-jBl0Qt.mjs} +16 -8
- package/dist/command-helpers-D-jBl0Qt.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +8 -6
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.d.mts.map +1 -1
- package/dist/commands/db-sign.mjs +11 -12
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +14 -15
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +13 -13
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +4 -2
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +4 -4
- package/dist/commands/migration-list.d.mts +1 -1
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.d.mts.map +1 -1
- package/dist/commands/migration-new.mjs +16 -40
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts +3 -4
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +5 -5
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.d.mts.map +1 -1
- package/dist/commands/ref.mjs +13 -18
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/contract-at-errors-DvZ_DzJK.mjs +36 -0
- package/dist/contract-at-errors-DvZ_DzJK.mjs.map +1 -0
- package/dist/{contract-emit-CgnXSANN.mjs → contract-emit-BT46Mu8Q.mjs} +3 -3
- package/dist/{contract-emit-CgnXSANN.mjs.map → contract-emit-BT46Mu8Q.mjs.map} +1 -1
- package/dist/{contract-emit-cJQBlvGb.mjs → contract-emit-hVdlaF2U.mjs} +6 -7
- package/dist/{contract-emit-cJQBlvGb.mjs.map → contract-emit-hVdlaF2U.mjs.map} +1 -1
- package/dist/{contract-enrichment-gn9sWbPw.mjs → contract-enrichment-JUhLv-BX.mjs} +8 -8
- package/dist/{contract-enrichment-gn9sWbPw.mjs.map → contract-enrichment-JUhLv-BX.mjs.map} +1 -1
- package/dist/{contract-infer-Cg8evbeg.mjs → contract-infer-DpqTQECL.mjs} +3 -3
- package/dist/{contract-infer-Cg8evbeg.mjs.map → contract-infer-DpqTQECL.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-D_3VeHVb.mjs → contract-space-aggregate-loader-CNd-ZB6C.mjs} +14 -14
- package/dist/contract-space-aggregate-loader-CNd-ZB6C.mjs.map +1 -0
- package/dist/{db-verify-BEclUzki.mjs → db-verify-FEN6k1m7.mjs} +10 -8
- package/dist/db-verify-FEN6k1m7.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +4 -4
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +3 -3
- package/dist/exports/index.d.mts +2 -1
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +61 -21
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/init-output.d.mts.map +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{format-DAUAZqPt.mjs → format-DI5qVr22.mjs} +8 -7
- package/dist/format-DI5qVr22.mjs.map +1 -0
- package/dist/{framework-components-CnbUbiJw.mjs → framework-components-C4XACYNB.mjs} +3 -3
- package/dist/framework-components-C4XACYNB.mjs.map +1 -0
- package/dist/{init-C3JhkHg-.mjs → init-ClrRkbwd.mjs} +77 -67
- package/dist/init-ClrRkbwd.mjs.map +1 -0
- package/dist/{inspect-live-schema-CX7EA5C3.mjs → inspect-live-schema-C0Rgdtw_.mjs} +4 -4
- package/dist/{inspect-live-schema-CX7EA5C3.mjs.map → inspect-live-schema-C0Rgdtw_.mjs.map} +1 -1
- package/dist/{migration-check-MHT3w7_v.mjs → migration-check-zEkHpPDT.mjs} +58 -30
- package/dist/migration-check-zEkHpPDT.mjs.map +1 -0
- package/dist/{migration-command-scaffold-CRyYrHZ9.mjs → migration-command-scaffold-CkNsp9g1.mjs} +4 -4
- package/dist/{migration-command-scaffold-CRyYrHZ9.mjs.map → migration-command-scaffold-CkNsp9g1.mjs.map} +1 -1
- package/dist/{migration-graph-command-render-B83xrnNy.mjs → migration-graph-command-render-DEwFpx-w.mjs} +5 -4
- package/dist/migration-graph-command-render-DEwFpx-w.mjs.map +1 -0
- package/dist/{migration-list-BAKujUjh.mjs → migration-list-BkafFVXS.mjs} +6 -6
- package/dist/migration-list-BkafFVXS.mjs.map +1 -0
- package/dist/{migration-log-C_xam2HZ.mjs → migration-log-BxhAtbhA.mjs} +5 -5
- package/dist/{migration-log-C_xam2HZ.mjs.map → migration-log-BxhAtbhA.mjs.map} +1 -1
- package/dist/{migration-path-target-DpPTsRCg.mjs → migration-path-target-B5HkjSTO.mjs} +2 -2
- package/dist/{migration-path-target-DpPTsRCg.mjs.map → migration-path-target-B5HkjSTO.mjs.map} +1 -1
- package/dist/{migration-plan-CreSVtWZ.mjs → migration-plan-Bk2pbPQH.mjs} +64 -74
- package/dist/migration-plan-Bk2pbPQH.mjs.map +1 -0
- package/dist/{migration-status-YgEvXf-u.mjs → migration-status-BzlARseq.mjs} +13 -12
- package/dist/migration-status-BzlARseq.mjs.map +1 -0
- package/dist/{output-mEQ74_nd.mjs → output-DWNYqZGc.mjs} +5 -6
- package/dist/output-DWNYqZGc.mjs.map +1 -0
- package/dist/{ref-advancement-BkXlikCA.mjs → ref-advancement-BCz7X7qJ.mjs} +13 -6
- package/dist/ref-advancement-BCz7X7qJ.mjs.map +1 -0
- package/dist/{telemetry-DVr6RFnq.mjs → telemetry-BbniBUbP.mjs} +2 -2
- package/dist/{telemetry-DVr6RFnq.mjs.map → telemetry-BbniBUbP.mjs.map} +1 -1
- package/dist/{types-D4r_HI9-.d.mts → types-DgXprE3w.d.mts} +3 -3
- package/dist/types-DgXprE3w.d.mts.map +1 -0
- package/dist/{verify-CgDVZjhc.mjs → verify-BSaNeaSL.mjs} +2 -2
- package/dist/{verify-CgDVZjhc.mjs.map → verify-BSaNeaSL.mjs.map} +1 -1
- package/package.json +21 -21
- package/src/commands/db-init.ts +5 -3
- package/src/commands/db-sign.ts +9 -7
- package/src/commands/db-update.ts +18 -9
- package/src/commands/db-verify.ts +4 -4
- package/src/commands/format.ts +1 -1
- package/src/commands/init/hygiene-gitattributes.ts +37 -21
- package/src/commands/init/init.ts +6 -6
- package/src/commands/init/output.ts +4 -5
- package/src/commands/init/probe-db.ts +9 -2
- package/src/commands/init/reinit-cleanup.ts +16 -17
- package/src/commands/init/templates/render.ts +2 -1
- package/src/commands/inspect-live-schema.ts +1 -1
- package/src/commands/migrate.ts +6 -5
- package/src/commands/migration-check.ts +72 -34
- package/src/commands/migration-list.ts +1 -5
- package/src/commands/migration-log.ts +1 -1
- package/src/commands/migration-new.ts +17 -41
- package/src/commands/migration-plan.ts +64 -88
- package/src/commands/migration-show.ts +2 -2
- package/src/commands/migration-status.ts +6 -7
- package/src/commands/ref.ts +19 -14
- package/src/control-api/client.ts +43 -25
- package/src/control-api/contract-enrichment.ts +7 -7
- package/src/control-api/operations/contract-emit.ts +2 -3
- package/src/control-api/operations/db-init.ts +3 -3
- package/src/control-api/operations/db-run.ts +8 -7
- package/src/control-api/operations/db-update.ts +2 -2
- package/src/control-api/operations/db-verify.ts +4 -4
- package/src/control-api/operations/format.ts +5 -4
- package/src/control-api/operations/migrate.ts +6 -5
- package/src/control-api/operations/run-migration.ts +2 -1
- package/src/control-api/types.ts +1 -1
- package/src/load-ts-contract.ts +81 -16
- package/src/utils/cli-errors.ts +15 -7
- package/src/utils/combine-verify-results.ts +2 -1
- package/src/utils/command-helpers.ts +15 -5
- package/src/utils/contract-at-errors.ts +13 -22
- package/src/utils/contract-space-aggregate-loader.ts +8 -8
- package/src/utils/contract-space-seed-phase.ts +11 -9
- package/src/utils/extension-pack-inputs.ts +8 -8
- package/src/utils/formatters/migration-graph-grid-layout.ts +2 -1
- package/src/utils/formatters/migration-graph-labels.ts +1 -2
- package/src/utils/formatters/migration-list-data-column.ts +1 -2
- package/src/utils/framework-components.ts +9 -9
- package/src/utils/integrity-violation-to-check-failure.ts +3 -3
- package/src/utils/migration-command-scaffold.ts +1 -1
- package/src/utils/plan-resolution.ts +7 -10
- package/src/utils/ref-advancement.ts +22 -3
- package/dist/client-KuBQftxz.mjs.map +0 -1
- package/dist/command-helpers-Cpq44aVa.mjs.map +0 -1
- package/dist/contract-at-errors-D9gEjYtg.mjs +0 -42
- package/dist/contract-at-errors-D9gEjYtg.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-D_3VeHVb.mjs.map +0 -1
- package/dist/db-verify-BEclUzki.mjs.map +0 -1
- package/dist/format-DAUAZqPt.mjs.map +0 -1
- package/dist/framework-components-CnbUbiJw.mjs.map +0 -1
- package/dist/init-C3JhkHg-.mjs.map +0 -1
- package/dist/migration-check-MHT3w7_v.mjs.map +0 -1
- package/dist/migration-graph-command-render-B83xrnNy.mjs.map +0 -1
- package/dist/migration-list-BAKujUjh.mjs.map +0 -1
- package/dist/migration-plan-CreSVtWZ.mjs.map +0 -1
- package/dist/migration-status-YgEvXf-u.mjs.map +0 -1
- package/dist/output-mEQ74_nd.mjs.map +0 -1
- package/dist/ref-advancement-BkXlikCA.mjs.map +0 -1
- package/dist/types-D4r_HI9-.d.mts.map +0 -1
- package/src/control-api/errors.ts +0 -9
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Commands that enforce wiring validation:
|
|
|
52
52
|
- **`db init`**
|
|
53
53
|
- **`db update`**
|
|
54
54
|
|
|
55
|
-
If you hit a wiring validation error: add the required descriptors to `config.
|
|
55
|
+
If you hit a wiring validation error: add the required descriptors to `config.extensions` (matched by descriptor `id`) and re-run the command.
|
|
56
56
|
|
|
57
57
|
**Note**: Control plane domain actions (database verification, contract emission) are implemented in `@prisma-next/emitter` and `@prisma-next/framework-components/control`. The CLI uses the control plane domain actions programmatically but does not define control plane types itself.
|
|
58
58
|
|
|
@@ -92,7 +92,7 @@ export default defineConfig({
|
|
|
92
92
|
family: sql,
|
|
93
93
|
target: postgres,
|
|
94
94
|
adapter: postgresAdapter,
|
|
95
|
-
|
|
95
|
+
extensions: [],
|
|
96
96
|
contract: typescriptContract(contract, 'src/prisma/contract.json'),
|
|
97
97
|
});
|
|
98
98
|
```
|
|
@@ -181,7 +181,7 @@ export default defineConfig({
|
|
|
181
181
|
target: postgres,
|
|
182
182
|
adapter: postgresAdapter,
|
|
183
183
|
driver: postgresDriver,
|
|
184
|
-
|
|
184
|
+
extensions: [],
|
|
185
185
|
contract: typescriptContract(contract, 'src/prisma/contract.json'),
|
|
186
186
|
db: {
|
|
187
187
|
connection: process.env.DATABASE_URL, // Optional: can also use --db flag
|
|
@@ -210,16 +210,16 @@ Success:
|
|
|
210
210
|
```text
|
|
211
211
|
✔ Database marker and schema match contract
|
|
212
212
|
verification: marker + schema
|
|
213
|
-
storageHash:
|
|
214
|
-
profileHash:
|
|
213
|
+
storageHash: abc123...
|
|
214
|
+
profileHash: def456...
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
Marker-only success:
|
|
218
218
|
```text
|
|
219
219
|
✔ Database marker matches contract
|
|
220
220
|
verification: marker only (--marker-only)
|
|
221
|
-
storageHash:
|
|
222
|
-
profileHash:
|
|
221
|
+
storageHash: abc123...
|
|
222
|
+
profileHash: def456...
|
|
223
223
|
|
|
224
224
|
⚠ Schema verification skipped because --marker-only was provided
|
|
225
225
|
```
|
|
@@ -242,12 +242,12 @@ Schema drift failure:
|
|
|
242
242
|
"summary": "Database marker and schema match contract",
|
|
243
243
|
"mode": "full",
|
|
244
244
|
"contract": {
|
|
245
|
-
"storageHash": "
|
|
246
|
-
"profileHash": "
|
|
245
|
+
"storageHash": "abc123...",
|
|
246
|
+
"profileHash": "def456..."
|
|
247
247
|
},
|
|
248
248
|
"marker": {
|
|
249
|
-
"storageHash": "
|
|
250
|
-
"profileHash": "
|
|
249
|
+
"storageHash": "abc123...",
|
|
250
|
+
"profileHash": "def456..."
|
|
251
251
|
},
|
|
252
252
|
"target": {
|
|
253
253
|
"expected": "postgres"
|
|
@@ -297,7 +297,7 @@ interface ControlStack<TFamilyId, TTargetId> {
|
|
|
297
297
|
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
|
|
298
298
|
readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
|
|
299
299
|
readonly driver: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
|
|
300
|
-
readonly
|
|
300
|
+
readonly extensions: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
interface ControlFamilyInstance {
|
|
@@ -311,7 +311,7 @@ interface ControlFamilyInstance {
|
|
|
311
311
|
}
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
-
Use `createControlStack()` from `@prisma-next/framework-components/control` to create the stack with sensible defaults (`driver` defaults to `undefined`, `
|
|
314
|
+
Use `createControlStack()` from `@prisma-next/framework-components/control` to create the stack with sensible defaults (`driver` defaults to `undefined`, `extensions` defaults to `[]`).
|
|
315
315
|
|
|
316
316
|
The SQL family provides this via `@prisma-next/family-sql/control`. The `verify()` method handles marker checks, full `db verify` follows it with `schemaVerify()`, `--marker-only` skips that schema step, and `--schema-only` runs `schemaVerify()` without marker checks.
|
|
317
317
|
|
|
@@ -404,7 +404,7 @@ export default defineConfig({
|
|
|
404
404
|
target: postgres,
|
|
405
405
|
adapter: postgresAdapter,
|
|
406
406
|
driver: postgresDriver,
|
|
407
|
-
|
|
407
|
+
extensions: [],
|
|
408
408
|
db: {
|
|
409
409
|
connection: process.env.DATABASE_URL, // Optional: can also use --db flag
|
|
410
410
|
},
|
|
@@ -555,7 +555,7 @@ export default defineConfig({
|
|
|
555
555
|
target: postgres,
|
|
556
556
|
adapter: postgresAdapter,
|
|
557
557
|
driver: postgresDriver,
|
|
558
|
-
|
|
558
|
+
extensions: [],
|
|
559
559
|
contract: typescriptContract(contract, 'src/prisma/contract.json'),
|
|
560
560
|
db: {
|
|
561
561
|
connection: process.env.DATABASE_URL, // Optional: can also use --db flag
|
|
@@ -584,25 +584,25 @@ export default defineConfig({
|
|
|
584
584
|
Success (new marker):
|
|
585
585
|
```
|
|
586
586
|
✔ Database signed (marker created)
|
|
587
|
-
storageHash:
|
|
588
|
-
profileHash:
|
|
587
|
+
storageHash: abc123...
|
|
588
|
+
profileHash: def456...
|
|
589
589
|
Total time: 42ms
|
|
590
590
|
```
|
|
591
591
|
|
|
592
592
|
Success (updated marker):
|
|
593
593
|
```
|
|
594
|
-
✔ Database signed (marker updated from
|
|
595
|
-
storageHash:
|
|
596
|
-
profileHash:
|
|
597
|
-
previous storageHash:
|
|
594
|
+
✔ Database signed (marker updated from old-hash)
|
|
595
|
+
storageHash: abc123...
|
|
596
|
+
profileHash: def456...
|
|
597
|
+
previous storageHash: old-hash
|
|
598
598
|
Total time: 42ms
|
|
599
599
|
```
|
|
600
600
|
|
|
601
601
|
Success (already up-to-date):
|
|
602
602
|
```
|
|
603
603
|
✔ Database already signed with this contract
|
|
604
|
-
storageHash:
|
|
605
|
-
profileHash:
|
|
604
|
+
storageHash: abc123...
|
|
605
|
+
profileHash: def456...
|
|
606
606
|
Total time: 42ms
|
|
607
607
|
```
|
|
608
608
|
|
|
@@ -619,8 +619,8 @@ Failure (schema mismatch):
|
|
|
619
619
|
"ok": true,
|
|
620
620
|
"summary": "Database signed (marker created)",
|
|
621
621
|
"contract": {
|
|
622
|
-
"storageHash": "
|
|
623
|
-
"profileHash": "
|
|
622
|
+
"storageHash": "abc123...",
|
|
623
|
+
"profileHash": "def456..."
|
|
624
624
|
},
|
|
625
625
|
"target": {
|
|
626
626
|
"expected": "postgres",
|
|
@@ -644,10 +644,10 @@ For updated markers:
|
|
|
644
644
|
```json
|
|
645
645
|
{
|
|
646
646
|
"ok": true,
|
|
647
|
-
"summary": "Database signed (marker updated from
|
|
647
|
+
"summary": "Database signed (marker updated from old-hash)",
|
|
648
648
|
"contract": {
|
|
649
|
-
"storageHash": "
|
|
650
|
-
"profileHash": "
|
|
649
|
+
"storageHash": "abc123...",
|
|
650
|
+
"profileHash": "def456..."
|
|
651
651
|
},
|
|
652
652
|
"target": {
|
|
653
653
|
"expected": "postgres",
|
|
@@ -657,8 +657,8 @@ For updated markers:
|
|
|
657
657
|
"created": false,
|
|
658
658
|
"updated": true,
|
|
659
659
|
"previous": {
|
|
660
|
-
"storageHash": "
|
|
661
|
-
"profileHash": "
|
|
660
|
+
"storageHash": "old-hash",
|
|
661
|
+
"profileHash": "old-profile-hash"
|
|
662
662
|
}
|
|
663
663
|
},
|
|
664
664
|
"meta": {
|
|
@@ -761,7 +761,7 @@ export default defineConfig({
|
|
|
761
761
|
target: postgres,
|
|
762
762
|
adapter: postgresAdapter,
|
|
763
763
|
driver: postgresDriver,
|
|
764
|
-
|
|
764
|
+
extensions: [],
|
|
765
765
|
contract: typescriptContract(contract, 'src/prisma/contract.json'),
|
|
766
766
|
db: {
|
|
767
767
|
connection: process.env.DATABASE_URL, // Optional: can also use --db flag
|
|
@@ -778,7 +778,7 @@ export default defineConfig({
|
|
|
778
778
|
5. **Validate wiring**: Ensures the contract is compatible with the CLI config:
|
|
779
779
|
- `contract.targetFamily` matches `config.family.familyId`
|
|
780
780
|
- `contract.target` matches `config.target.targetId`
|
|
781
|
-
- `contract.
|
|
781
|
+
- `contract.extensions` (if present) are provided by `config.extensions` (matched by descriptor `id`)
|
|
782
782
|
6. **Create Planner/Runner**: Uses `config.target.migrations.createPlanner()` and `config.target.migrations.createRunner()`
|
|
783
783
|
7. **Plan Migration**: Calls `planner.plan()` with the contract, schema IR, additive-only policy, and `frameworkComponents` (the active target/adapter/extension descriptors)
|
|
784
784
|
- On conflict: Returns a structured failure with conflict list
|
|
@@ -803,7 +803,7 @@ prisma-next db init ➜ Bootstrap a database to match the current contract
|
|
|
803
803
|
├─ Create index user_email_idx on user [additive]
|
|
804
804
|
└─ Add foreign key post_userId_fkey on post [additive]
|
|
805
805
|
|
|
806
|
-
Destination hash:
|
|
806
|
+
Destination hash: abc123...
|
|
807
807
|
|
|
808
808
|
This is a dry run. No changes were applied.
|
|
809
809
|
Run without --dry-run to apply changes.
|
|
@@ -822,7 +822,7 @@ Applying migration plan and verifying schema...
|
|
|
822
822
|
→ Create index user_email_idx on user...
|
|
823
823
|
→ Add foreign key post_userId_fkey on post...
|
|
824
824
|
✔ Applied 4 operation(s)
|
|
825
|
-
Marker written:
|
|
825
|
+
Marker written: abc123...
|
|
826
826
|
```
|
|
827
827
|
|
|
828
828
|
**Output Format (JSON):**
|
|
@@ -834,7 +834,7 @@ Applying migration plan and verifying schema...
|
|
|
834
834
|
"plan": {
|
|
835
835
|
"targetId": "postgres",
|
|
836
836
|
"destination": {
|
|
837
|
-
"storageHash": "
|
|
837
|
+
"storageHash": "abc123..."
|
|
838
838
|
},
|
|
839
839
|
"operations": [
|
|
840
840
|
{
|
|
@@ -849,7 +849,7 @@ Applying migration plan and verifying schema...
|
|
|
849
849
|
"operationsExecuted": 4
|
|
850
850
|
},
|
|
851
851
|
"marker": {
|
|
852
|
-
"storageHash": "
|
|
852
|
+
"storageHash": "abc123..."
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
```
|
|
@@ -891,7 +891,7 @@ prisma-next db update [--db <url>] [--config <path>] [--dry-run] [-y|--yes] [--i
|
|
|
891
891
|
|
|
892
892
|
**Config File (`prisma-next.config.ts`):**
|
|
893
893
|
|
|
894
|
-
The CLI uses a config file to specify the target family, target, adapter,
|
|
894
|
+
The CLI uses a config file to specify the target family, target, adapter, extensions, and contract.
|
|
895
895
|
|
|
896
896
|
**Config Discovery:**
|
|
897
897
|
- `--config <path>`: Explicit path (relative or absolute)
|
|
@@ -912,7 +912,7 @@ export default defineConfig({
|
|
|
912
912
|
family: sql,
|
|
913
913
|
target: postgres,
|
|
914
914
|
adapter: postgresAdapter,
|
|
915
|
-
|
|
915
|
+
extensions: [],
|
|
916
916
|
contract: typescriptContract(contract, 'src/prisma/contract.json'),
|
|
917
917
|
});
|
|
918
918
|
```
|
|
@@ -952,15 +952,14 @@ prisma-next migration plan [--config <path>] [--name <slug>] [--from <contract>]
|
|
|
952
952
|
2. Reads existing migrations from `config.migrations.dir` (default: `migrations/`)
|
|
953
953
|
3. Determines the starting point: `--from <contract>` if provided, otherwise the `db` ref (greenfield when absent)
|
|
954
954
|
4. Diffs the starting contract against the destination using the target's migration planner
|
|
955
|
-
5. Scaffolds a new migration package: `migration.ts` (containing `placeholder(...)` lambdas for any data transforms), `migration.json` (with a content-addressed `migrationHash` over the planned ops, or over `[]` when the planner could not lower any calls because of placeholders), `ops.json` (the planned ops, or `[]` in the placeholder-blocked case)
|
|
955
|
+
5. Scaffolds a new migration package: `migration.ts` (containing `placeholder(...)` lambdas for any data transforms), `migration.json` (with a content-addressed `migrationHash` over the planned ops, or over `[]` when the planner could not lower any calls because of placeholders), and `ops.json` (the planned ops, or `[]` in the placeholder-blocked case). The bookend contracts are written write-if-absent into the shared snapshot store at `migrations/snapshots/<hex>/contract.{json,d.ts}`. The package is **always** fully attested — there is no draft state on disk.
|
|
956
956
|
6. If the plan has unfilled `placeholder(...)` slots, the command returns a successful `pendingPlaceholders` envelope (a warning, not a failure) asking the developer to fill in the slots before re-emitting. The on-disk `ops.json` is `[]` and `migrationHash` is the hash of `(metadata, [])`, so applying the migration as-written will not advance the storage hash to the intended destination — the runner's destination-hash post-check surfaces this as a state mismatch. After filling in the placeholders, run `node migrations/<dir>/migration.ts` to re-emit `ops.json` and the corresponding `migrationHash`. `PN-MIG-2001` is raised only at self-emit time when a slot is still unfilled.
|
|
957
957
|
|
|
958
958
|
**Outputs:**
|
|
959
959
|
- `migrations/<dir>/migration.ts` — editable migration source (with `placeholder(...)` slots when the planner inserted them)
|
|
960
960
|
- `migrations/<dir>/migration.json` — fully attested metadata (`migrationHash: string`, never null)
|
|
961
961
|
- `migrations/<dir>/ops.json` — planned operations (empty list `[]` if placeholders blocked the planner)
|
|
962
|
-
- `migrations/<
|
|
963
|
-
- `migrations/<dir>/end-contract.{json,d.ts}` — bookend from the "to" side
|
|
962
|
+
- `migrations/snapshots/<hex>/contract.{json,d.ts}` — bookend contracts, written write-if-absent, keyed by each contract's storage hash (one entry for `from` when applicable, one for `to`)
|
|
964
963
|
|
|
965
964
|
**Branching with `--from` and `--to`:** Use `--from` to create a migration edge from a specific contract hash instead of the default starting point. Use `--to` to plan toward any resolved contract — including a rollback via `<migration-dir>^` — instead of the emitted contract. This enables branched migration graphs and arbitrary-target (including reverse) edges without editing contract source.
|
|
966
965
|
|
|
@@ -1028,7 +1027,7 @@ prisma-next migrate [--db <url>] [--to <contract>] [--config <path>] [--json] [-
|
|
|
1028
1027
|
|
|
1029
1028
|
**Options:**
|
|
1030
1029
|
- `--db <url>`: Database connection string (optional; defaults to `config.db.connection`)
|
|
1031
|
-
- `--to <contract>`: Target contract reference (hash, prefix, ref name, migration directory, `<dir>^`, or filesystem path). When omitted, applies toward the emitted `contract.json`. When `--to` resolves to an on-disk graph node, verification and apply use that
|
|
1030
|
+
- `--to <contract>`: Target contract reference (hash, prefix, ref name, migration directory, `<dir>^`, or filesystem path). When omitted, applies toward the emitted `contract.json`. When `--to` resolves to an on-disk graph node, verification and apply use the snapshot store entry for that node's hash — so a planned rollback or other arbitrary-target edge applies without editing contract source.
|
|
1032
1031
|
- `--ref <name>`: Target a named ref from `migrations/refs.json` instead of the current contract hash
|
|
1033
1032
|
- `--config <path>`: Path to `prisma-next.config.ts`
|
|
1034
1033
|
- `--json`: Output as JSON object
|
|
@@ -1085,7 +1084,7 @@ prisma-next ref delete <name> # Delete a ref
|
|
|
1085
1084
|
|
|
1086
1085
|
**Ref naming rules:** Lowercase alphanumeric with hyphens or forward slashes (e.g., `staging`, `prod/us-east`). No `.` or `..` segments.
|
|
1087
1086
|
|
|
1088
|
-
**Ref values:** Must be valid contract hashes (
|
|
1087
|
+
**Ref values:** Must be valid contract hashes (64 lowercase hex chars, or the `empty` sentinel).
|
|
1089
1088
|
|
|
1090
1089
|
**Atomic writes:** `refs.json` is written atomically via temp file + rename to prevent corruption from concurrent writes.
|
|
1091
1090
|
|
|
@@ -1295,7 +1294,7 @@ import exampleExtension from '@prisma-next/extension-example/control';
|
|
|
1295
1294
|
|
|
1296
1295
|
export default defineConfig({
|
|
1297
1296
|
// family/target/adapter/driver omitted for brevity
|
|
1298
|
-
|
|
1297
|
+
extensions: [exampleExtension],
|
|
1299
1298
|
});
|
|
1300
1299
|
```
|
|
1301
1300
|
|
|
@@ -1390,7 +1389,7 @@ const client = createControlClient({
|
|
|
1390
1389
|
target: postgres,
|
|
1391
1390
|
adapter: postgresAdapter,
|
|
1392
1391
|
driver: postgresDriver,
|
|
1393
|
-
|
|
1392
|
+
extensions: [],
|
|
1394
1393
|
});
|
|
1395
1394
|
|
|
1396
1395
|
try {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as isCI, O as formatCommandHelp, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, k as formatRootHelp, l as setCommandDescriptions, m as deriveCanPrompt, t as addGlobalOptions, u as setCommandExamples, v as installShutdownHandlers } from "./command-helpers-
|
|
3
|
-
import { t as createContractEmitCommand } from "./contract-emit-
|
|
4
|
-
import { t as createContractInferCommand } from "./contract-infer-
|
|
2
|
+
import { D as isCI, O as formatCommandHelp, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, k as formatRootHelp, l as setCommandDescriptions, m as deriveCanPrompt, t as addGlobalOptions, u as setCommandExamples, v as installShutdownHandlers } from "./command-helpers-D-jBl0Qt.mjs";
|
|
3
|
+
import { t as createContractEmitCommand } from "./contract-emit-BT46Mu8Q.mjs";
|
|
4
|
+
import { t as createContractInferCommand } from "./contract-infer-DpqTQECL.mjs";
|
|
5
5
|
import { createDbInitCommand } from "./commands/db-init.mjs";
|
|
6
6
|
import { createDbSchemaCommand } from "./commands/db-schema.mjs";
|
|
7
7
|
import { createDbSignCommand } from "./commands/db-sign.mjs";
|
|
8
8
|
import { createDbUpdateCommand } from "./commands/db-update.mjs";
|
|
9
|
-
import { t as createDbVerifyCommand } from "./db-verify-
|
|
10
|
-
import { t as createFormatCommand } from "./format-
|
|
11
|
-
import { t as createMigrationListCommand } from "./migration-list-
|
|
9
|
+
import { t as createDbVerifyCommand } from "./db-verify-FEN6k1m7.mjs";
|
|
10
|
+
import { t as createFormatCommand } from "./format-DI5qVr22.mjs";
|
|
11
|
+
import { t as createMigrationListCommand } from "./migration-list-BkafFVXS.mjs";
|
|
12
12
|
import { createMigrateCommand } from "./commands/migrate.mjs";
|
|
13
|
-
import { t as createMigrationCheckCommand } from "./migration-check-
|
|
13
|
+
import { t as createMigrationCheckCommand } from "./migration-check-zEkHpPDT.mjs";
|
|
14
14
|
import { createMigrationGraphCommand } from "./commands/migration-graph.mjs";
|
|
15
|
-
import { t as createMigrationLogCommand } from "./migration-log-
|
|
15
|
+
import { t as createMigrationLogCommand } from "./migration-log-BxhAtbhA.mjs";
|
|
16
16
|
import { createMigrationNewCommand } from "./commands/migration-new.mjs";
|
|
17
|
-
import { t as createMigrationPlanCommand } from "./migration-plan-
|
|
17
|
+
import { t as createMigrationPlanCommand } from "./migration-plan-Bk2pbPQH.mjs";
|
|
18
18
|
import { createMigrationShowCommand } from "./commands/migration-show.mjs";
|
|
19
|
-
import { r as createMigrationStatusCommand } from "./migration-status-
|
|
19
|
+
import { r as createMigrationStatusCommand } from "./migration-status-BzlARseq.mjs";
|
|
20
20
|
import { createRefCommand } from "./commands/ref.mjs";
|
|
21
|
-
import { t as createTelemetryCommand } from "./telemetry-
|
|
21
|
+
import { t as createTelemetryCommand } from "./telemetry-BbniBUbP.mjs";
|
|
22
22
|
import { Command } from "commander";
|
|
23
23
|
import { DEFAULT_CONTRACT_SOURCE_DIR } from "@prisma-next/config/config-types";
|
|
24
24
|
import { ensureInstallationId, readUserConfig, resolveGating, runTelemetry, userConfigPath } from "@prisma-next/cli-telemetry";
|
|
25
25
|
import { distance } from "closest-match";
|
|
26
26
|
import { fileURLToPath } from "node:url";
|
|
27
27
|
//#region package.json
|
|
28
|
-
var version = "0.16.0-dev.
|
|
28
|
+
var version = "0.16.0-dev.31";
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/commands/init/templates/code-templates.ts
|
|
31
31
|
function targetPackageName(target) {
|
|
@@ -294,7 +294,7 @@ Exit codes (see CLI Style Guide § Exit Codes):
|
|
|
294
294
|
"prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)"
|
|
295
295
|
]);
|
|
296
296
|
return addGlobalOptions(command).option("--target <db>", "Database target: postgres or mongodb").option("--authoring <style>", "Schema authoring style: psl or typescript").option("--schema-path <path>", `Where to write the starter schema (default: ${defaultSchemaPath("psl")})`).option("--force", "Overwrite an existing scaffold without prompting").option("--write-env", "Write a .env file from .env.example (gitignored; default: only .env.example)").option("--probe-db", "Connect to DATABASE_URL once and check the server version against the target minimum (opt-in; off by default)").option("--strict-probe", "Treat a failed --probe-db as fatal (no-op without --probe-db; init is offline-by-default)").option("--no-install", "Skip dependency installation and contract emission").option("--no-skill", "Skip Prisma Next skills install (air-gapped CI, restricted registries, etc.)").action(async (options) => {
|
|
297
|
-
const { runInit } = await import("./init-
|
|
297
|
+
const { runInit } = await import("./init-ClrRkbwd.mjs");
|
|
298
298
|
const flags = parseGlobalFlagsOrExit(options);
|
|
299
299
|
const canPrompt = deriveCanPrompt({
|
|
300
300
|
flagsInteractive: flags.interactive,
|