@prisma/orm-toolchain 8.0.0-rc.13-dev.3 → 8.0.0-rc.13-dev.4

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/dist/cli.mjs CHANGED
@@ -35,7 +35,7 @@ import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
35
35
  import stringWidth from "string-width";
36
36
  import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
37
37
  import { build } from "esbuild";
38
- //#region ../../../1-framework/3-tooling/cli/dist/load-config-Bg0L8lzV.mjs
38
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-OBtYidHx.mjs
39
39
  /**
40
40
  * `isStructuredError` is the repo's own check, and it is the one that matters here: it holds the
41
41
  * regular expression for a dotted `NAMESPACE.SUBCODE`, so only a code the protocol accepts
@@ -1635,6 +1635,11 @@ function schemaVerdictDiagnostic(inputs) {
1635
1635
  }
1636
1636
  };
1637
1637
  }
1638
+ function schemaDriftNextActions(inputs) {
1639
+ const { verb, contractRef } = inputs;
1640
+ const retryAfterEmit = contractRef === void 0 ? `${verb} again` : `${verb} the emitted contract instead of "${contractRef}"`;
1641
+ return [runCommandAction(`Change the database to match the contract, then ${verb} again`, contractRef === void 0 ? "{bin} db update" : `{bin} db update --to "${contractRef}"`), chooseAction(`Or change the contract source to describe the database as it is, re-run contract emit, then ${retryAfterEmit}`)];
1642
+ }
1638
1643
  /**
1639
1644
  * Verification ran and refused the signature. The command completed — it
1640
1645
  * answered the question "may this database be signed?" — so the refusal is a
@@ -1895,7 +1900,10 @@ function createDbSignCommand(createClient = createControlClient) {
1895
1900
  diagnostics: [schemaVerdictDiagnostic({
1896
1901
  result: verified,
1897
1902
  space: void 0,
1898
- nextActions: [runCommandAction("Bring the database up to the contract, then sign again", "{bin} db update")]
1903
+ nextActions: schemaDriftNextActions({
1904
+ verb: "sign",
1905
+ contractRef
1906
+ })
1899
1907
  })]
1900
1908
  }, refusedPresentations({
1901
1909
  document,
@@ -2312,11 +2320,6 @@ function combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {
2312
2320
  * diagnostics rather than an error.
2313
2321
  */
2314
2322
  const FINDINGS_EXIT_CODE$1 = 4;
2315
- const PUSH_THE_CONTRACT = runCommandAction("Push the contract to the database", "{bin} db update");
2316
- const RECONCILE_BY_HAND = {
2317
- kind: "user-choice",
2318
- label: "Or reconcile the differences by hand and verify again"
2319
- };
2320
2323
  function errorInvalidVerifyMode(options) {
2321
2324
  return new CliStructuredError$1("CLI.INVALID_VERIFY_MODE", "Invalid verify mode", {
2322
2325
  why: options.why,
@@ -2512,7 +2515,10 @@ function driftDiagnostics(inputs) {
2512
2515
  const perSpace = [...inputs.perSpace].filter(([, result]) => !result.ok).map(([space, result]) => schemaVerdictDiagnostic({
2513
2516
  result,
2514
2517
  space,
2515
- nextActions: [PUSH_THE_CONTRACT, RECONCILE_BY_HAND]
2518
+ nextActions: schemaDriftNextActions({
2519
+ verb: "verify",
2520
+ contractRef: void 0
2521
+ })
2516
2522
  }));
2517
2523
  if (perSpace.length > 0) return perSpace;
2518
2524
  return [schemaVerdictDiagnostic({