@prisma/orm-toolchain 8.0.0-rc.1-dev.27 → 8.0.0-rc.1-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 (105) hide show
  1. package/dist/bin__prisma-next.mjs +24 -24
  2. package/dist/bin__prisma-next.mjs.map +1 -1
  3. package/dist/cli.d.mts +2 -2
  4. package/dist/cli.mjs +253 -89
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/cli__commands__contract-emit.mjs +1 -1
  7. package/dist/cli__commands__contract-infer.mjs +1 -1
  8. package/dist/cli__commands__db-init.mjs +1 -1
  9. package/dist/cli__commands__db-schema.mjs +1 -1
  10. package/dist/cli__commands__db-sign.mjs +1 -1
  11. package/dist/cli__commands__db-update.mjs +1 -1
  12. package/dist/cli__commands__db-verify.mjs +1 -1
  13. package/dist/cli__commands__migrate.mjs +1 -1
  14. package/dist/cli__commands__migration-check.mjs +1 -1
  15. package/dist/cli__commands__migration-graph.d.mts.map +1 -1
  16. package/dist/cli__commands__migration-graph.mjs +1 -1
  17. package/dist/cli__commands__migration-list.mjs +1 -1
  18. package/dist/cli__commands__migration-log.mjs +1 -1
  19. package/dist/cli__commands__migration-new.mjs +1 -1
  20. package/dist/cli__commands__migration-plan.mjs +1 -1
  21. package/dist/cli__commands__migration-show.mjs +1 -1
  22. package/dist/cli__commands__migration-status.mjs +1 -1
  23. package/dist/cli__commands__ref.mjs +1 -1
  24. package/dist/cli__commands__telemetry.mjs +1 -1
  25. package/dist/cli__control-api.d.mts +14 -13
  26. package/dist/cli__control-api.d.mts.map +1 -1
  27. package/dist/cli__control-api.mjs +9 -9
  28. package/dist/{client-CaIWFVnh-PVaTEvdx.mjs → client-DLPcSdv7-Cukdon0q.mjs} +3 -3
  29. package/dist/{client-CaIWFVnh-PVaTEvdx.mjs.map → client-DLPcSdv7-Cukdon0q.mjs.map} +1 -1
  30. package/dist/{command-helpers-DutQjYgy-CDfFwtAa.mjs → command-helpers-uzQbbM97-EaL4zWf5.mjs} +3 -3
  31. package/dist/{command-helpers-DutQjYgy-CDfFwtAa.mjs.map → command-helpers-uzQbbM97-EaL4zWf5.mjs.map} +1 -1
  32. package/dist/{contract-emit-BJDLPMxp-qaGmQUQr.mjs → contract-emit-D-vxAjLQ-DjSGIBvi.mjs} +4 -4
  33. package/dist/{contract-emit-BJDLPMxp-qaGmQUQr.mjs.map → contract-emit-D-vxAjLQ-DjSGIBvi.mjs.map} +1 -1
  34. package/dist/{contract-infer-B929dnCJ-KkT9frLY.mjs → contract-infer-ButdiRXM-9KdWYvza.mjs} +5 -5
  35. package/dist/{contract-infer-B929dnCJ-KkT9frLY.mjs.map → contract-infer-ButdiRXM-9KdWYvza.mjs.map} +1 -1
  36. package/dist/{contract-snapshot-resolution-D2f9kGs0-BenF4tbi.mjs → contract-snapshot-resolution-RIn-ByLW-BRTjU_01.mjs} +3 -3
  37. package/dist/{contract-snapshot-resolution-D2f9kGs0-BenF4tbi.mjs.map → contract-snapshot-resolution-RIn-ByLW-BRTjU_01.mjs.map} +1 -1
  38. package/dist/{contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs → contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs} +3 -3
  39. package/dist/{contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs.map → contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs.map} +1 -1
  40. package/dist/{db-init-CU_x-p2M-_6oEFLiG.mjs → db-init-BO7P4kCG-CftJygKc.mjs} +5 -5
  41. package/dist/{db-init-CU_x-p2M-_6oEFLiG.mjs.map → db-init-BO7P4kCG-CftJygKc.mjs.map} +1 -1
  42. package/dist/{db-schema-BKAn8UrM-DP4k7BAB.mjs → db-schema-6CB4Rljf-VFKrJ3VO.mjs} +6 -6
  43. package/dist/{db-schema-BKAn8UrM-DP4k7BAB.mjs.map → db-schema-6CB4Rljf-VFKrJ3VO.mjs.map} +1 -1
  44. package/dist/{db-sign-BQF-jVXg-D467Bhpj.mjs → db-sign-CkX4HXCx-B0mTmQ5a.mjs} +7 -7
  45. package/dist/{db-sign-BQF-jVXg-D467Bhpj.mjs.map → db-sign-CkX4HXCx-B0mTmQ5a.mjs.map} +1 -1
  46. package/dist/{db-update-B0_Q4ykE-CT9vcaMu.mjs → db-update-fAeM1XbT-B5XoGE92.mjs} +6 -6
  47. package/dist/{db-update-B0_Q4ykE-CT9vcaMu.mjs.map → db-update-fAeM1XbT-B5XoGE92.mjs.map} +1 -1
  48. package/dist/{db-verify-C0DJc8z6-f3gZeEMD.mjs → db-verify-_flf8M9q-BD-mhGC1.mjs} +6 -6
  49. package/dist/{db-verify-C0DJc8z6-f3gZeEMD.mjs.map → db-verify-_flf8M9q-BD-mhGC1.mjs.map} +1 -1
  50. package/dist/{format-SYdHyutg-IqXk-tDV.mjs → format-DZ7Vowat-CXVeLGp_.mjs} +4 -4
  51. package/dist/{format-SYdHyutg-IqXk-tDV.mjs.map → format-DZ7Vowat-CXVeLGp_.mjs.map} +1 -1
  52. package/dist/{init-Bw8YKgpj-CMOgQZPx.mjs → init-Cej3fMLO-BCRVDzA4.mjs} +3 -3
  53. package/dist/{init-Bw8YKgpj-CMOgQZPx.mjs.map → init-Cej3fMLO-BCRVDzA4.mjs.map} +1 -1
  54. package/dist/{inspect-live-schema-D8d7aI6a-_Q_4S5wm.mjs → inspect-live-schema-Do1dDQxw-DBSSeLrX.mjs} +4 -4
  55. package/dist/{inspect-live-schema-D8d7aI6a-_Q_4S5wm.mjs.map → inspect-live-schema-Do1dDQxw-DBSSeLrX.mjs.map} +1 -1
  56. package/dist/{invariants-TW5CizTS-BsIpi4h4.mjs → invariants-4d2LkjQL-Ch5J3Rd7.mjs} +3 -3
  57. package/dist/{invariants-TW5CizTS-BsIpi4h4.mjs.map → invariants-4d2LkjQL-Ch5J3Rd7.mjs.map} +1 -1
  58. package/dist/{migrate-vNMZJk7M-DKogRyOh.mjs → migrate-Bs4Mi3N0-BdbjoiNr.mjs} +9 -9
  59. package/dist/{migrate-vNMZJk7M-DKogRyOh.mjs.map → migrate-Bs4Mi3N0-BdbjoiNr.mjs.map} +1 -1
  60. package/dist/{migrate-show-C-fdCznr-BH88FGVn.mjs → migrate-show-BYZ_NAoY-DCyUeA4P.mjs} +5 -5
  61. package/dist/{migrate-show-C-fdCznr-BH88FGVn.mjs.map → migrate-show-BYZ_NAoY-DCyUeA4P.mjs.map} +1 -1
  62. package/dist/{migration-check-DATj3HSn-Del6ZSln.mjs → migration-check-ASAenQ02-B9a5jI8S.mjs} +6 -6
  63. package/dist/{migration-check-DATj3HSn-Del6ZSln.mjs.map → migration-check-ASAenQ02-B9a5jI8S.mjs.map} +1 -1
  64. package/dist/{migration-check-C-2GTAGq-Duc0P6Uo.mjs → migration-check-RlegqnJv-ZUcop5v4.mjs} +4 -4
  65. package/dist/{migration-check-C-2GTAGq-Duc0P6Uo.mjs.map → migration-check-RlegqnJv-ZUcop5v4.mjs.map} +1 -1
  66. package/dist/{migration-command-scaffold-BezR8GWB-BZFB2PC-.mjs → migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs} +4 -4
  67. package/dist/{migration-command-scaffold-BezR8GWB-BZFB2PC-.mjs.map → migration-command-scaffold-Bc5j_ehJ-BF4cqm9C.mjs.map} +1 -1
  68. package/dist/{migration-graph-B1mg_jel-HVG6FLD0.mjs → migration-graph-BYRfJ6pm-WucWOxZ8.mjs} +7 -7
  69. package/dist/{migration-graph-B1mg_jel-HVG6FLD0.mjs.map → migration-graph-BYRfJ6pm-WucWOxZ8.mjs.map} +1 -1
  70. package/dist/{migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs → migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs} +321 -153
  71. package/dist/migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs.map +1 -0
  72. package/dist/{migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs → migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs} +5 -3
  73. package/dist/migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs.map +1 -0
  74. package/dist/{migration-list-RSlyGyvD-KKmZtdY1.mjs → migration-list-ChJ4YC1Y-De7g_D3K.mjs} +6 -6
  75. package/dist/{migration-list-RSlyGyvD-KKmZtdY1.mjs.map → migration-list-ChJ4YC1Y-De7g_D3K.mjs.map} +1 -1
  76. package/dist/{migration-log-CBfOcyPC-DTqCL1cs.mjs → migration-log-W8xgEvD8-sVkmO78U.mjs} +7 -7
  77. package/dist/{migration-log-CBfOcyPC-DTqCL1cs.mjs.map → migration-log-W8xgEvD8-sVkmO78U.mjs.map} +1 -1
  78. package/dist/{migration-log-table-C0dSMG9T-BhBYrdka.mjs → migration-log-table-JR7fFVbE-DR2mom6h.mjs} +4 -4
  79. package/dist/{migration-log-table-C0dSMG9T-BhBYrdka.mjs.map → migration-log-table-JR7fFVbE-DR2mom6h.mjs.map} +1 -1
  80. package/dist/{migration-new-DcPO4tiw-Bew7S-bj.mjs → migration-new-BGI2g0SC-SUBmaeRN.mjs} +4 -4
  81. package/dist/{migration-new-DcPO4tiw-Bew7S-bj.mjs.map → migration-new-BGI2g0SC-SUBmaeRN.mjs.map} +1 -1
  82. package/dist/{migration-new-1LYliIXy-BK_Xz0Z6.mjs → migration-new-BHv-aJzG-Bj7aJDNX.mjs} +5 -5
  83. package/dist/{migration-new-1LYliIXy-BK_Xz0Z6.mjs.map → migration-new-BHv-aJzG-Bj7aJDNX.mjs.map} +1 -1
  84. package/dist/{migration-plan-B0z2Qpa5-6b1SJSsb.mjs → migration-plan-31dDf3Wj-_kWI5F9v.mjs} +5 -5
  85. package/dist/{migration-plan-B0z2Qpa5-6b1SJSsb.mjs.map → migration-plan-31dDf3Wj-_kWI5F9v.mjs.map} +1 -1
  86. package/dist/{migration-plan-Cb7s5Ifx-Bwa2O0Ov.mjs → migration-plan-B4ND_Xr3-CXfh2r_I.mjs} +4 -4
  87. package/dist/{migration-plan-Cb7s5Ifx-Bwa2O0Ov.mjs.map → migration-plan-B4ND_Xr3-CXfh2r_I.mjs.map} +1 -1
  88. package/dist/{migration-show-BRy1GVBE-NuwoczhZ.mjs → migration-show-CxT14RTs-Bpfd4_FB.mjs} +6 -6
  89. package/dist/{migration-show-BRy1GVBE-NuwoczhZ.mjs.map → migration-show-CxT14RTs-Bpfd4_FB.mjs.map} +1 -1
  90. package/dist/{migration-status-Dob4onB1-0YkQF25g.mjs → migration-status-gC9RLpz5-3uPzlkh_.mjs} +8 -8
  91. package/dist/{migration-status-Dob4onB1-0YkQF25g.mjs.map → migration-status-gC9RLpz5-3uPzlkh_.mjs.map} +1 -1
  92. package/dist/{ref-D9J4TNYz-Dk7HCAoq.mjs → ref-CbeIycGH-Da61MuYq.mjs} +4 -4
  93. package/dist/{ref-D9J4TNYz-Dk7HCAoq.mjs.map → ref-CbeIycGH-Da61MuYq.mjs.map} +1 -1
  94. package/dist/{ref-B643Z0CS-CoJgdv7h.mjs → ref-Dmj_cDrl-Cax2R649.mjs} +5 -5
  95. package/dist/{ref-B643Z0CS-CoJgdv7h.mjs.map → ref-Dmj_cDrl-Cax2R649.mjs.map} +1 -1
  96. package/dist/{telemetry-DFEbk6sD-BYEW2bCJ.mjs → telemetry-D4LZGV1f-C5BrCb0w.mjs} +4 -4
  97. package/dist/{telemetry-DFEbk6sD-BYEW2bCJ.mjs.map → telemetry-D4LZGV1f-C5BrCb0w.mjs.map} +1 -1
  98. package/dist/{terminal-ui-DQNCDg2u-B3PFqjB8.mjs → terminal-ui-CUZTa2vH-WvAtuIOS.mjs} +3 -10
  99. package/dist/terminal-ui-CUZTa2vH-WvAtuIOS.mjs.map +1 -0
  100. package/dist/{verify-TphNCyMu-h8vrnbud.mjs → verify-DGFra-rl-B5lkrUrV.mjs} +3 -3
  101. package/dist/{verify-TphNCyMu-h8vrnbud.mjs.map → verify-DGFra-rl-B5lkrUrV.mjs.map} +1 -1
  102. package/package.json +13 -13
  103. package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +0 -1
  104. package/dist/migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs.map +0 -1
  105. package/dist/terminal-ui-DQNCDg2u-B3PFqjB8.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,21 +1,21 @@
1
1
  import { i as loadConfig } from "./exports-BZLNbtkY.mjs";
2
2
  import { F as requireLiveDatabase, N as errorUnexpected, a as errorConfigValidation$1, b as errorNoMigrations, d as errorFileNotFound, h as errorLegendHumanOnly, j as errorTargetMigrationNotSupported, s as errorContractValidationFailed, v as errorMigrationPackageNotFound } from "./cli-errors-CihMAEVj-C1uUYBop.mjs";
3
3
  import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-05kuwcb0.mjs";
4
- import { p as renderMigrationShowLines } from "./terminal-ui-DQNCDg2u-B3PFqjB8.mjs";
4
+ import { p as previewBlockHeader } from "./terminal-ui-CUZTa2vH-WvAtuIOS.mjs";
5
5
  import { c as spaceMigrationDirectory } from "./verify-contract-spaces-WvjSiWcB-DZPPCwWO.mjs";
6
- import { S as targetSupportsMigrations, f as maskConnectionUrl, n as closeQuietly } from "./command-helpers-DutQjYgy-CDfFwtAa.mjs";
7
- import { t as createContractEmitCommand } from "./contract-emit-BJDLPMxp-qaGmQUQr.mjs";
8
- import { t as createFormatCommand } from "./format-SYdHyutg-IqXk-tDV.mjs";
9
- import { a as loadContractSpaceAggregateForCli, r as buildReadAggregate } from "./contract-space-aggregate-loader-sF0OJ6oz-jRjdZoyZ.mjs";
10
- import { t as createControlClient } from "./client-CaIWFVnh-PVaTEvdx.mjs";
6
+ import { S as targetSupportsMigrations, f as maskConnectionUrl, n as closeQuietly } from "./command-helpers-uzQbbM97-EaL4zWf5.mjs";
7
+ import { t as createContractEmitCommand } from "./contract-emit-D-vxAjLQ-DjSGIBvi.mjs";
8
+ import { t as createFormatCommand } from "./format-DZ7Vowat-CXVeLGp_.mjs";
9
+ import { a as loadContractSpaceAggregateForCli, r as buildReadAggregate } from "./contract-space-aggregate-loader-Cd0X2M_C-CFBkD540.mjs";
10
+ import { t as createControlClient } from "./client-DLPcSdv7-Cukdon0q.mjs";
11
11
  import { t as mapCaughtMigrationError } from "./caught-errors-B_oGFiYw-BqX49eW0.mjs";
12
12
  import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-AKRIIovW-Cr39jOaI.mjs";
13
13
  import { n as resolveMigrationRef } from "./ref-resolution-Bi4lpxM8-BX-7sl0f.mjs";
14
- import { g as renderMigrationGraphLegend, l as createAnsiMigrationListStyler, v as renderMigrationListWithStyle } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
14
+ import { S as toneSpans, b as renderMigrationListWithStyle, d as createToneMigrationListStyler, n as TONE_MIGRATION_GRAPH_PALETTE, v as renderMigrationGraphLegend, x as toneDrawing } from "./migration-graph-command-render-CgdHruiZ-B6V4gmUe.mjs";
15
15
  import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-yA4h5Zc6-DlzBblBG.mjs";
16
16
  import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-BtP1Va3T-CMOZgqVW.mjs";
17
- import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-BVqyqBHg-DAwWjIIf.mjs";
18
- import { n as renderMigrationLogTable, r as serializeLedgerEntriesForJson, t as MIGRATION_LOG_EMPTY_MESSAGE } from "./migration-log-table-C0dSMG9T-BhBYrdka.mjs";
17
+ import { n as renderMigrationGraphDot, r as renderMigrationGraphSections, t as buildMigrationGraphTreeSections } from "./migration-graph-sections-CceYWPCP-Bz8vmjNZ.mjs";
18
+ import { a as sortLedgerEntries, i as serializeLedgerEntriesForJson, n as formatLedgerAppliedAt, o as styleHashTransition, t as MIGRATION_LOG_EMPTY_MESSAGE } from "./migration-log-table-JR7fFVbE-DR2mom6h.mjs";
19
19
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
20
20
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
21
21
  import { join, normalize, relative, resolve } from "pathe";
@@ -31,7 +31,7 @@ import { defineCommand, defineCommandFamily, defineConfigSection, flag, position
31
31
  import { CliStructuredError as CliStructuredError$1, notOk, ok } from "@prisma/cli-engine/protocol";
32
32
  import { pathToFileURL } from "node:url";
33
33
  import { build } from "esbuild";
34
- //#region ../../../1-framework/3-tooling/cli/dist/load-config-Bj0g_Kv6.mjs
34
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-DFptcz_M.mjs
35
35
  const MISSING_CONFIG_ACTION = {
36
36
  kind: "run-command",
37
37
  label: "Create a configuration file",
@@ -282,22 +282,35 @@ function contractPathFor(config, cwd) {
282
282
  function displayPath(path, cwd) {
283
283
  return relative(cwd, path);
284
284
  }
285
+ /**
286
+ * The tree is a drawing for a reader; the DOT document is a graph description
287
+ * for another program, so it is the one thing here that belongs on stdout.
288
+ */
285
289
  function graphPresentations(inputs) {
290
+ const { tree, dot, legend } = inputs;
286
291
  return {
287
- human: () => [{
288
- kind: "fields",
289
- rows: [{
290
- label: "migrations",
291
- value: inputs.migrationsDir
292
- }, ...inputs.space === void 0 ? [] : [{
293
- label: "space",
294
- value: inputs.space
295
- }]]
296
- }, ...inputs.legendLines.length === 0 ? [] : [{
297
- kind: "list",
298
- items: [...inputs.legendLines]
299
- }]],
300
- stdout: () => inputs.lines,
292
+ human: () => [
293
+ {
294
+ kind: "fields",
295
+ rail: true,
296
+ rows: [{
297
+ label: "migrations",
298
+ value: inputs.migrationsDir
299
+ }, ...inputs.space === void 0 ? [] : [{
300
+ label: "space",
301
+ value: inputs.space
302
+ }]]
303
+ },
304
+ ...tree === void 0 ? [] : [{
305
+ kind: "drawing",
306
+ lines: toneDrawing(tree)
307
+ }],
308
+ ...legend === void 0 ? [] : [{
309
+ kind: "drawing",
310
+ lines: toneDrawing(legend)
311
+ }]
312
+ ],
313
+ ...dot === void 0 ? {} : { stdout: () => dot.split("\n") },
301
314
  json: () => inputs.document
302
315
  };
303
316
  }
@@ -357,42 +370,56 @@ const migrationGraphCommand = defineOrmCommand({
357
370
  ...graphDocument,
358
371
  dot
359
372
  };
360
- const lines = dot === void 0 ? renderMigrationGraphSections(buildMigrationGraphTreeSections({
373
+ const styler = createToneMigrationListStyler();
374
+ const tree = dot === void 0 ? renderMigrationGraphSections(buildMigrationGraphTreeSections({
361
375
  aggregate,
362
376
  scopedSpaces,
363
377
  liveContractHash,
364
378
  glyphMode,
365
- colorize: false
366
- }), summary).split("\n") : dot.split("\n");
367
- const legendLines = args.flags.legend ? renderMigrationGraphLegend({
368
- colorize: false,
369
- glyphMode
370
- }).split("\n") : [];
379
+ colorize: true,
380
+ styler,
381
+ palette: TONE_MIGRATION_GRAPH_PALETTE
382
+ }), styler.summary(summary)) : void 0;
383
+ const legend = args.flags.legend ? renderMigrationGraphLegend({
384
+ colorize: true,
385
+ glyphMode,
386
+ styler,
387
+ palette: TONE_MIGRATION_GRAPH_PALETTE
388
+ }) : void 0;
371
389
  return ok(ctx.present({ data: document }, graphPresentations({
372
390
  document,
373
- lines,
391
+ tree,
392
+ dot,
374
393
  migrationsDir: displayPath(migrationsDir, ctx.cwd),
375
394
  space: args.flags.space,
376
- legendLines
395
+ legend
377
396
  })));
378
397
  }
379
398
  });
380
399
  function listPresentations(inputs) {
400
+ const legend = inputs.legend;
381
401
  return {
382
- human: () => [{
383
- kind: "fields",
384
- rows: [{
385
- label: "migrations",
386
- value: inputs.migrationsDir
387
- }, ...inputs.space === void 0 ? [] : [{
388
- label: "space",
389
- value: inputs.space
390
- }]]
391
- }, ...inputs.legendLines.length === 0 ? [] : [{
392
- kind: "list",
393
- items: [...inputs.legendLines]
394
- }]],
395
- stdout: () => inputs.lines,
402
+ human: () => [
403
+ {
404
+ kind: "fields",
405
+ rail: true,
406
+ rows: [{
407
+ label: "migrations",
408
+ value: inputs.migrationsDir
409
+ }, ...inputs.space === void 0 ? [] : [{
410
+ label: "space",
411
+ value: inputs.space
412
+ }]]
413
+ },
414
+ {
415
+ kind: "drawing",
416
+ lines: toneDrawing(inputs.tree)
417
+ },
418
+ ...legend === void 0 ? [] : [{
419
+ kind: "drawing",
420
+ lines: toneDrawing(legend)
421
+ }]
422
+ ],
396
423
  json: () => inputs.list
397
424
  };
398
425
  }
@@ -428,22 +455,26 @@ const migrationListCommand = defineOrmCommand({
428
455
  });
429
456
  if (!listed.ok) return notOk(normalizeError(listed.failure));
430
457
  const glyphMode = args.flags.ascii ? "ascii" : "unicode";
431
- const lines = renderMigrationListWithStyle(listed.value, createAnsiMigrationListStyler({ useColor: false }), glyphMode, {
432
- colorize: false,
458
+ const styler = createToneMigrationListStyler();
459
+ const tree = renderMigrationListWithStyle(listed.value, styler, glyphMode, {
460
+ colorize: true,
461
+ palette: TONE_MIGRATION_GRAPH_PALETTE,
433
462
  liveContractHash,
434
463
  graphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),
435
464
  appSpaceId: aggregate.app.spaceId
436
- }).split("\n");
437
- const legendLines = args.flags.legend ? renderMigrationGraphLegend({
438
- colorize: false,
439
- glyphMode
440
- }).split("\n") : [];
465
+ });
466
+ const legend = args.flags.legend ? renderMigrationGraphLegend({
467
+ colorize: true,
468
+ glyphMode,
469
+ styler,
470
+ palette: TONE_MIGRATION_GRAPH_PALETTE
471
+ }) : void 0;
441
472
  return ok(ctx.present({ data: listed.value }, listPresentations({
442
473
  list: listed.value,
443
- lines,
474
+ tree,
444
475
  migrationsDir: displayPath(migrationsDir, ctx.cwd),
445
476
  space: args.flags.space,
446
- legendLines
477
+ legend
447
478
  })));
448
479
  }
449
480
  });
@@ -457,27 +488,54 @@ const dbFlag = flag.string({
457
488
  brief: "Database connection string",
458
489
  placeholder: "url"
459
490
  });
491
+ const HEADING_APPLIED_AT = "Applied at";
492
+ const HEADING_SPACE = "Space";
493
+ const HEADING_MIGRATION = "Migration";
494
+ const HEADING_CHANGE = "Change";
495
+ const HEADING_OPS = "Ops";
496
+ /**
497
+ * The ledger laid out for the engine to size. The Space heading appears only
498
+ * when more than one contract space has run, as it does in the commander shell.
499
+ */
500
+ function ledgerGrid(entries, options) {
501
+ const styler = createToneMigrationListStyler();
502
+ const sorted = sortLedgerEntries(entries);
503
+ const showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;
504
+ const headings = [HEADING_APPLIED_AT];
505
+ if (showSpace) headings.push(HEADING_SPACE);
506
+ headings.push(HEADING_MIGRATION, HEADING_CHANGE, HEADING_OPS);
507
+ return {
508
+ headings,
509
+ rows: sorted.map((entry) => {
510
+ const cells = [formatLedgerAppliedAt(entry.appliedAt, options.utc ? "utc" : "local")];
511
+ if (showSpace) cells.push(entry.space);
512
+ cells.push(toneSpans(styler.dirName(entry.migrationName)), toneSpans(styleHashTransition(entry.from, entry.to, styler, options.glyphMode)), `${entry.operationCount} ops`);
513
+ return cells;
514
+ })
515
+ };
516
+ }
460
517
  function logPresentations(inputs) {
518
+ const grid = inputs.grid;
461
519
  return {
462
- human: () => inputs.database === void 0 ? [] : [{
520
+ human: () => [...inputs.database === void 0 ? [] : [{
463
521
  kind: "fields",
522
+ rail: true,
464
523
  rows: [{
465
524
  label: "database",
466
525
  value: inputs.database
467
526
  }]
468
- }],
469
- stdout: () => inputs.lines,
527
+ }], ...grid === void 0 ? [{
528
+ kind: "summary",
529
+ status: "info",
530
+ text: MIGRATION_LOG_EMPTY_MESSAGE
531
+ }] : [{
532
+ kind: "table",
533
+ columns: grid.headings,
534
+ rows: grid.rows
535
+ }]],
470
536
  json: () => inputs.document
471
537
  };
472
538
  }
473
- function logLines(entries, options) {
474
- if (entries.length === 0) return [MIGRATION_LOG_EMPTY_MESSAGE];
475
- return renderMigrationLogTable(entries, {
476
- utc: options.utc,
477
- styler: createAnsiMigrationListStyler({ useColor: false }),
478
- glyphMode: options.glyphMode
479
- }).split("\n");
480
- }
481
539
  const migrationLogCommand = defineOrmCommand({
482
540
  help: {
483
541
  summary: "Show executed migration history",
@@ -530,7 +588,7 @@ const migrationLogCommand = defineOrmCommand({
530
588
  const glyphMode = args.flags.ascii ? "ascii" : "unicode";
531
589
  return ok(ctx.present({ data: document }, logPresentations({
532
590
  document,
533
- lines: logLines(entries, {
591
+ grid: entries.length === 0 ? void 0 : ledgerGrid(entries, {
534
592
  utc: args.flags.utc,
535
593
  glyphMode
536
594
  }),
@@ -538,26 +596,118 @@ const migrationLogCommand = defineOrmCommand({
538
596
  })));
539
597
  }
540
598
  });
599
+ /** One node per operation, the destructive ones carrying the warning glyph. */
600
+ function operationNodes(migration) {
601
+ return migration.operations.map((operation) => operation.operationClass === "destructive" ? {
602
+ label: operation.label,
603
+ status: "warn"
604
+ } : { label: operation.label });
605
+ }
606
+ function operationBlocks(migration) {
607
+ if (migration.operations.length === 0) return [{
608
+ kind: "summary",
609
+ status: "info",
610
+ text: "No operations."
611
+ }];
612
+ const destructive = migration.operations.some((operation) => operation.operationClass === "destructive");
613
+ return [{
614
+ kind: "tree",
615
+ roots: [{
616
+ label: `${migration.operations.length} operation(s)`,
617
+ children: operationNodes(migration)
618
+ }]
619
+ }, ...destructive ? [{
620
+ kind: "summary",
621
+ status: "warn",
622
+ text: "This migration contains destructive operations that may cause data loss."
623
+ }] : []];
624
+ }
625
+ /**
626
+ * The statement preview: text a database would run, printed verbatim rather
627
+ * than laid out, so nothing is re-wrapped between here and the reader.
628
+ */
629
+ function previewBlocks(migration) {
630
+ const statements = migration.preview.statements.map((statement) => statement.text.trim()).filter((text) => text.length > 0).map((text) => text.endsWith(";") ? text : `${text};`);
631
+ if (statements.length === 0) return [];
632
+ return [{
633
+ kind: "summary",
634
+ status: "info",
635
+ tone: "muted",
636
+ text: previewBlockHeader(migration.preview)
637
+ }, {
638
+ kind: "drawing",
639
+ lines: statements
640
+ }];
641
+ }
541
642
  function showPresentations(inputs) {
643
+ const migration = inputs.document.migration;
542
644
  return {
543
- human: () => [{
544
- kind: "fields",
545
- rows: [
546
- {
547
- label: "contract",
548
- value: inputs.contractPath
549
- },
550
- {
551
- label: "migrations",
552
- value: inputs.appMigrationsRelative
553
- },
554
- {
555
- label: "target",
556
- value: inputs.target
557
- }
558
- ]
559
- }],
560
- stdout: () => renderMigrationShowLines(inputs.document.migration, { colorize: false }),
645
+ human: () => [
646
+ {
647
+ kind: "fields",
648
+ rail: true,
649
+ rows: [
650
+ {
651
+ label: "contract",
652
+ value: inputs.contractPath
653
+ },
654
+ {
655
+ label: "migrations",
656
+ value: inputs.appMigrationsRelative
657
+ },
658
+ {
659
+ label: "target",
660
+ value: inputs.target
661
+ }
662
+ ]
663
+ },
664
+ {
665
+ kind: "summary",
666
+ status: "ok",
667
+ text: [{
668
+ text: migration.name,
669
+ tone: "emphasis"
670
+ }]
671
+ },
672
+ {
673
+ kind: "fields",
674
+ rows: [
675
+ {
676
+ label: "from",
677
+ value: migration.fromContract === null ? [{
678
+ text: "(baseline)",
679
+ tone: "muted"
680
+ }] : [{
681
+ text: migration.fromContract,
682
+ tone: "identifier"
683
+ }]
684
+ },
685
+ {
686
+ label: "to",
687
+ value: [{
688
+ text: migration.toContract,
689
+ tone: "identifier"
690
+ }]
691
+ },
692
+ {
693
+ label: "hash",
694
+ value: [{
695
+ text: migration.hash,
696
+ tone: "identifier"
697
+ }]
698
+ },
699
+ {
700
+ label: "created",
701
+ value: [{
702
+ text: migration.createdAt,
703
+ tone: "muted"
704
+ }]
705
+ }
706
+ ]
707
+ },
708
+ ...operationBlocks(migration),
709
+ ...previewBlocks(migration)
710
+ ],
561
711
  json: () => inputs.document
562
712
  };
563
713
  }
@@ -687,8 +837,8 @@ const migrationShowCommand = defineOrmCommand({
687
837
  const DOCS_BASE_URL = `${DOCS_BASE}/`;
688
838
  /**
689
839
  * The unit the ORM contributes to a CLI: its config section, its commands by
690
- * name, and where its diagnostics are documented. The shell owns the command
691
- * tree, so nothing here says where a command mounts.
840
+ * name, where its diagnostics are documented, and the invocations it retired.
841
+ * The shell owns the command tree, so nothing here says where a command mounts.
692
842
  */
693
843
  const ormCommandFamily = defineCommandFamily({
694
844
  configSection: ormConfigSection,
@@ -698,8 +848,19 @@ const ormCommandFamily = defineCommandFamily({
698
848
  "migration log": migrationLogCommand,
699
849
  "migration show": migrationShowCommand
700
850
  },
701
- docsBaseUrl: DOCS_BASE_URL
851
+ docsBaseUrl: DOCS_BASE_URL,
852
+ redirects: [{
853
+ from: "migration apply",
854
+ replacement: "{bin} migrate --to <contract>",
855
+ reason: "Applying a migration is a move to a target contract, not a verb of its own."
856
+ }, {
857
+ from: "migration ref",
858
+ replacement: "{bin} ref set|list|delete",
859
+ reason: "Refs are managed by their own command, for every space rather than migrations alone."
860
+ }]
702
861
  });
862
+ /** The file the ORM's loader reads when `--config` names none. */
863
+ const ORM_CONFIG_FILENAME = "prisma-next.config.ts";
703
864
  /**
704
865
  * Builds the engine's `Runtime.config` from `prisma-next.config.ts`.
705
866
  *
@@ -715,8 +876,10 @@ const ormCommandFamily = defineCommandFamily({
715
876
  * config. Structural verdicts belong to the section validator.
716
877
  */
717
878
  async function loadOrmConfig(options) {
879
+ const path = resolve(options.cwd, options.configPath ?? ORM_CONFIG_FILENAME);
718
880
  const loaded = await loadConfig(options.configPath, { cwd: options.cwd });
719
881
  if (!loaded.ok) return {
882
+ path,
720
883
  sections: {},
721
884
  diagnostics: [{
722
885
  section: null,
@@ -724,6 +887,7 @@ async function loadOrmConfig(options) {
724
887
  }]
725
888
  };
726
889
  return {
890
+ path,
727
891
  sections: { ["orm"]: loaded.value.config },
728
892
  diagnostics: []
729
893
  };