@prisma/orm-toolchain 8.0.0-rc.4-dev.15 → 8.0.0-rc.4-dev.17
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/{aggregate-BOlLu7k7.mjs → aggregate-EMuVN6hq.mjs} +8 -8
- package/dist/{aggregate-BOlLu7k7.mjs.map → aggregate-EMuVN6hq.mjs.map} +1 -1
- package/dist/cli.mjs +60 -65
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__migration-cli.mjs +3 -3
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs} +3 -3
- package/dist/{contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs.map → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map} +1 -1
- package/dist/{errors-CcEpbfnE-CsSXrttT.mjs → errors-SoLLYLtw-DMxVbVs9.mjs} +9 -9
- package/dist/errors-SoLLYLtw-DMxVbVs9.mjs.map +1 -0
- package/dist/{graph-membership-BoITerZB-C2-x1Qp6.mjs → graph-membership-DY1Onbc3-CwBd6wuB.mjs} +3 -3
- package/dist/{graph-membership-BoITerZB-C2-x1Qp6.mjs.map → graph-membership-DY1Onbc3-CwBd6wuB.mjs.map} +1 -1
- package/dist/{invariants-DcFfhJMZ-BHDWZP9k.mjs → invariants-Cww4bv0v-BEiFxmbX.mjs} +3 -3
- package/dist/{invariants-DcFfhJMZ-BHDWZP9k.mjs.map → invariants-Cww4bv0v-BEiFxmbX.mjs.map} +1 -1
- package/dist/{io-DsViRB_O-Ci1kJGBg.mjs → io-BmWQNxRP-DQqbcPsS.mjs} +5 -5
- package/dist/{io-DsViRB_O-Ci1kJGBg.mjs.map → io-BmWQNxRP-DQqbcPsS.mjs.map} +1 -1
- package/dist/{migration-CWSj4pMr.mjs → migration-B9w-7dKe.mjs} +3 -3
- package/dist/{migration-CWSj4pMr.mjs.map → migration-B9w-7dKe.mjs.map} +1 -1
- package/dist/{migration-graph-DwXAHP6T-NgmP2DNz.mjs → migration-graph-CW4bMmTz-B5xFtFVB.mjs} +3 -3
- package/dist/{migration-graph-DwXAHP6T-NgmP2DNz.mjs.map → migration-graph-CW4bMmTz-B5xFtFVB.mjs.map} +1 -1
- package/dist/migration-tools.mjs +12 -12
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-DJkSkzAt-DCYlpVrB.mjs → ref-XdaDN3GF-Io-mSVS6.mjs} +51 -51
- package/dist/ref-XdaDN3GF-Io-mSVS6.mjs.map +1 -0
- package/dist/{ref-resolution-Cbdejrwt.mjs → ref-resolution-D77jPigU.mjs} +2 -2
- package/dist/{ref-resolution-Cbdejrwt.mjs.map → ref-resolution-D77jPigU.mjs.map} +1 -1
- package/dist/{refs-KVVlm3lE-BcqdpdYD.mjs → refs-BpSpzdYB-BcDelHGt.mjs} +9 -9
- package/dist/refs-BpSpzdYB-BcDelHGt.mjs.map +1 -0
- package/dist/{spaces-CHrjWRoZ.mjs → spaces-BCZiAZQn.mjs} +6 -6
- package/dist/{spaces-CHrjWRoZ.mjs.map → spaces-BCZiAZQn.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs} +7 -7
- package/dist/{verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs.map → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/errors-CcEpbfnE-CsSXrttT.mjs.map +0 -1
- package/dist/ref-DJkSkzAt-DCYlpVrB.mjs.map +0 -1
- package/dist/refs-KVVlm3lE-BcqdpdYD.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as getEmittedArtifactPaths } from "./exports-Dw2WIX63-CQgI2e_L.mjs";
|
|
2
2
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
|
-
import { c as spaceMigrationDirectory } from "./verify-contract-spaces-
|
|
3
|
+
import { c as spaceMigrationDirectory } from "./verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs";
|
|
4
4
|
import { i as createScaffoldSpecifierResolver } from "./import-roots-kw_vAdpJ.mjs";
|
|
5
|
-
import { $ as loadContractRawSafely, A as errorMigrationPlanningFailed, At as statusForMigrationHash, C as errorDestructiveChanges, Ct as resolveRefAdvancementFields, D as errorLegendHumanOnly, Dt as runMigrationCheck, E as errorHashMismatch, F as errorTargetMigrationNotSupported, H as executeMigrateShowPlan, I as errorTargetMismatch, J as executeRefSetCommand, K as executeRefDeleteCommand, L as errorUnexpected, M as errorPathUnreachable, Mt as toDeclaredExtensionsFromRaw, N as errorRunnerFailed, O as errorMarkerMissing, Ot as runMigrationList, P as errorRuntime, Q as loadAggregateIntegrityViolations, R as executeContractEmit, S as errorDatabaseConnectionRequired, St as resolveMigrationRef, T as errorFileNotFound, Tt as runCommandAction, U as executeMigrationNewCommand, W as executeMigrationPlanCommand, X as hasMigrationPath, Y as findPackageByDirPath, Z as listRefsByContractHash, _ as enumerateCheckSpaces, _t as requireLiveDatabase, at as maskConnectionUrl, b as errorContractArgConflict, bt as resolveContractRefToSnapshot, ct as readContractEnvelope, d as closeQuietly, dt as refuseContractSpaceIntegrity, et as loadContractSpaceAggregateForCli, gt as refuseUnknownInvariants, ht as refusePackageCorruptionOnAggregate, i as appliedHashesFromLedger, j as errorNoMigrations, jt as targetSupportsMigrations, k as errorMigrationPackageNotFound, kt as sanitizeErrorMessage, l as checkSingleTarget, lt as readContractIR, m as deriveStatusEdgeAnnotations, mt as refuseMissingInvariantPath, n as advanceRefSafely, nt as mapCaughtMigrationError, o as buildMigrationSpaceGraphEntries, ot as migrationSpaceListEntriesFromAggregate, p as createControlClient, pt as refuseMarkerOutsideGraph, q as executeRefListCommand, rt as mapContractAtError, s as buildReadAggregate, st as originHashForStatus, t as CliStructuredError$1$1, tt as looksLikePath, u as chooseAction, ut as readMigrationRefs, v as errorConfigValidation$1, vt as resolveAppTargetPath, w as errorDriverRequired, x as errorContractValidationFailed, y as errorConsentPlanMismatch, yt as resolveContractRef$1 } from "./ref-
|
|
5
|
+
import { $ as loadContractRawSafely, A as errorMigrationPlanningFailed, At as statusForMigrationHash, C as errorDestructiveChanges, Ct as resolveRefAdvancementFields, D as errorLegendHumanOnly, Dt as runMigrationCheck, E as errorHashMismatch, F as errorTargetMigrationNotSupported, H as executeMigrateShowPlan, I as errorTargetMismatch, J as executeRefSetCommand, K as executeRefDeleteCommand, L as errorUnexpected, M as errorPathUnreachable, Mt as toDeclaredExtensionsFromRaw, N as errorRunnerFailed, O as errorMarkerMissing, Ot as runMigrationList, P as errorRuntime, Q as loadAggregateIntegrityViolations, R as executeContractEmit, S as errorDatabaseConnectionRequired, St as resolveMigrationRef, T as errorFileNotFound, Tt as runCommandAction, U as executeMigrationNewCommand, W as executeMigrationPlanCommand, X as hasMigrationPath, Y as findPackageByDirPath, Z as listRefsByContractHash, _ as enumerateCheckSpaces, _t as requireLiveDatabase, at as maskConnectionUrl, b as errorContractArgConflict, bt as resolveContractRefToSnapshot, ct as readContractEnvelope, d as closeQuietly, dt as refuseContractSpaceIntegrity, et as loadContractSpaceAggregateForCli, gt as refuseUnknownInvariants, ht as refusePackageCorruptionOnAggregate, i as appliedHashesFromLedger, j as errorNoMigrations, jt as targetSupportsMigrations, k as errorMigrationPackageNotFound, kt as sanitizeErrorMessage, l as checkSingleTarget, lt as readContractIR, m as deriveStatusEdgeAnnotations, mt as refuseMissingInvariantPath, n as advanceRefSafely, nt as mapCaughtMigrationError, o as buildMigrationSpaceGraphEntries, ot as migrationSpaceListEntriesFromAggregate, p as createControlClient, pt as refuseMarkerOutsideGraph, q as executeRefListCommand, rt as mapContractAtError, s as buildReadAggregate, st as originHashForStatus, t as CliStructuredError$1$1, tt as looksLikePath, u as chooseAction, ut as readMigrationRefs, v as errorConfigValidation$1, vt as resolveAppTargetPath, w as errorDriverRequired, x as errorContractValidationFailed, y as errorConsentPlanMismatch, yt as resolveContractRef$1 } from "./ref-XdaDN3GF-Io-mSVS6.mjs";
|
|
6
6
|
import { n as buildNextSteps, t as InitOutputSchema } from "./output-CovTDY14-CUoAqLML.mjs";
|
|
7
7
|
import { r as loadConfig, t as finalizeConfig } from "./exports-Cv8nMmBT.mjs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
@@ -33,12 +33,12 @@ import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
|
33
33
|
import stringWidth from "string-width";
|
|
34
34
|
import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
|
|
35
35
|
import { build } from "esbuild";
|
|
36
|
-
//#region ../../../1-framework/3-tooling/cli/dist/load-config-
|
|
37
|
-
var version = "8.0.0-rc.4-dev.
|
|
36
|
+
//#region ../../../1-framework/3-tooling/cli/dist/load-config-DJbtUqmo.mjs
|
|
37
|
+
var version = "8.0.0-rc.4-dev.17";
|
|
38
38
|
const MISSING_CONFIG_ACTION = {
|
|
39
39
|
kind: "run-command",
|
|
40
40
|
label: "Create a config file",
|
|
41
|
-
command: "
|
|
41
|
+
command: "{bin} orm init"
|
|
42
42
|
};
|
|
43
43
|
function editConfigAction(field) {
|
|
44
44
|
return {
|
|
@@ -602,7 +602,7 @@ function mapDbInitFailure(failure) {
|
|
|
602
602
|
if (failure.code === "PLANNING_FAILED") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });
|
|
603
603
|
if (failure.code === "MIGRATION.MARKER_ORIGIN_MISMATCH") return errorRuntime("MIGRATION.MARKER_ORIGIN_MISMATCH", `Existing database signature does not match plan destination.${markerMismatchDetail(failure)}`, {
|
|
604
604
|
why: "Database has an existing signature (marker) that does not match the target contract",
|
|
605
|
-
fix: "If bootstrapping, drop/reset the database then re-run `
|
|
605
|
+
fix: "If bootstrapping, drop/reset the database then re-run `{bin} db init`; otherwise reconcile schema/marker using your migration workflow",
|
|
606
606
|
meta: {
|
|
607
607
|
...ifDefined("markerStorageHash", failure.marker?.storageHash),
|
|
608
608
|
...ifDefined("destinationStorageHash", failure.destination?.storageHash),
|
|
@@ -611,7 +611,7 @@ function mapDbInitFailure(failure) {
|
|
|
611
611
|
}
|
|
612
612
|
});
|
|
613
613
|
if (failure.code === "RUNNER_FAILED") {
|
|
614
|
-
const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "MIGRATION.LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `
|
|
614
|
+
const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "MIGRATION.LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `{bin} db init` to recreate it with the current per-space schema." : "Fix the schema mismatch (db init is additive-only), or drop/reset the database and re-run `{bin} db init`";
|
|
615
615
|
return errorRunnerFailed(failure.summary, {
|
|
616
616
|
why: failure.why ?? "Migration runner failed",
|
|
617
617
|
fix,
|
|
@@ -846,7 +846,7 @@ function migrationResultBlocks(result) {
|
|
|
846
846
|
}
|
|
847
847
|
/** Where the user goes next, as typed actions rather than trailing prose. */
|
|
848
848
|
function migrationResultNextActions(result, applyCommand) {
|
|
849
|
-
return result.mode === "plan" ? [runCommandAction("Apply the planned operations", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? "Confirm the space is up to date" : "Confirm every space is up to date", "
|
|
849
|
+
return result.mode === "plan" ? [runCommandAction("Apply the planned operations", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? "Confirm the space is up to date" : "Confirm every space is up to date", "{bin} migration status")];
|
|
850
850
|
}
|
|
851
851
|
/**
|
|
852
852
|
* Where migrations live for this project. Resolved against the invocation
|
|
@@ -901,7 +901,7 @@ async function readContractDocument(contractPath) {
|
|
|
901
901
|
} catch (error) {
|
|
902
902
|
return notOk$1(normalizeError(Reflect.get(Object(error), "code") === "ENOENT" ? errorFileNotFound(contractPath, {
|
|
903
903
|
why: `Contract file not found at ${contractPath}`,
|
|
904
|
-
fix: "Run `
|
|
904
|
+
fix: "Run `{bin} contract emit` to generate contract.json, or update `contract.output` in prisma.config.ts"
|
|
905
905
|
}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` })));
|
|
906
906
|
}
|
|
907
907
|
try {
|
|
@@ -967,7 +967,7 @@ function initPresentations$1(inputs) {
|
|
|
967
967
|
]
|
|
968
968
|
}, ...migrationResultBlocks(document)],
|
|
969
969
|
json: () => document,
|
|
970
|
-
next: () => migrationResultNextActions(document, "
|
|
970
|
+
next: () => migrationResultNextActions(document, "{bin} db init")
|
|
971
971
|
};
|
|
972
972
|
}
|
|
973
973
|
function initDocument(inputs) {
|
|
@@ -1299,7 +1299,7 @@ async function readEmittedContract(inputs) {
|
|
|
1299
1299
|
} catch (error) {
|
|
1300
1300
|
return notOk$1(normalizeError(Reflect.get(Object(error), "code") === "ENOENT" ? errorFileNotFound(path, {
|
|
1301
1301
|
why: `Contract file not found at ${path}`,
|
|
1302
|
-
fix: `Run \`
|
|
1302
|
+
fix: `Run \`{bin} contract emit\` to generate ${relativePath}, or update \`contract.output\` in prisma.config.ts`
|
|
1303
1303
|
}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` })));
|
|
1304
1304
|
}
|
|
1305
1305
|
const familyInstance = inputs.config.family.create(createControlStack(inputs.config));
|
|
@@ -1322,7 +1322,7 @@ function requireVerifyConnection(inputs) {
|
|
|
1322
1322
|
if (typeof dbConnection !== "string" || dbConnection.length === 0) return notOk$1(normalizeError(errorDatabaseConnectionRequired({
|
|
1323
1323
|
why: `Database connection is required for ${inputs.invocation} (set db.connection in prisma.config.ts, or pass --db <url>)`,
|
|
1324
1324
|
missingFlags: ["--db"],
|
|
1325
|
-
retryCommand: `
|
|
1325
|
+
retryCommand: `{bin} ${inputs.invocation} --db <url>`
|
|
1326
1326
|
})));
|
|
1327
1327
|
if (inputs.config.driver === void 0) return notOk$1(normalizeError(errorDriverRequired({ why: `Config.driver is required for ${inputs.invocation}` })));
|
|
1328
1328
|
return ok$1(dbConnection);
|
|
@@ -1616,7 +1616,7 @@ function createDbSignCommand(createClient = createControlClient) {
|
|
|
1616
1616
|
diagnostics: [schemaVerdictDiagnostic({
|
|
1617
1617
|
result: verified,
|
|
1618
1618
|
space: void 0,
|
|
1619
|
-
nextActions: [runCommandAction("Bring the database up to the contract, then sign again", "
|
|
1619
|
+
nextActions: [runCommandAction("Bring the database up to the contract, then sign again", "{bin} db update")]
|
|
1620
1620
|
})]
|
|
1621
1621
|
}, refusedPresentations({
|
|
1622
1622
|
document,
|
|
@@ -1664,7 +1664,7 @@ const dbSignCommand = createDbSignCommand();
|
|
|
1664
1664
|
function mapDbUpdateFailure(failure) {
|
|
1665
1665
|
if (failure.code === "PLANNING_FAILED") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });
|
|
1666
1666
|
if (failure.code === "RUNNER_FAILED") {
|
|
1667
|
-
const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "MIGRATION.LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `
|
|
1667
|
+
const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "MIGRATION.LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `{bin} db init` to recreate it with the current per-space schema." : "Inspect the reported conflict, reconcile schema drift if needed, then re-run `{bin} db update`";
|
|
1668
1668
|
return errorRunnerFailed(failure.summary, {
|
|
1669
1669
|
why: failure.why ?? "Migration runner failed",
|
|
1670
1670
|
fix,
|
|
@@ -1677,7 +1677,7 @@ function mapDbUpdateFailure(failure) {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
if (failure.code === "DESTRUCTIVE_CHANGES") return errorDestructiveChanges(failure.summary, {
|
|
1679
1679
|
...ifDefined("why", failure.why),
|
|
1680
|
-
fix: "Re-run `
|
|
1680
|
+
fix: "Re-run `{bin} db update` and type the database name when asked, or pass `--no-interactive --confirm <database>` where there is nobody to ask. Use `--dry-run` to preview the operations first.",
|
|
1681
1681
|
...failure.destructiveChanges ? { meta: {
|
|
1682
1682
|
destructiveOperations: failure.destructiveChanges.destructiveOperations,
|
|
1683
1683
|
databaseName: failure.destructiveChanges.databaseName,
|
|
@@ -1701,7 +1701,7 @@ function errorConsentTokenUnresolved(targetId) {
|
|
|
1701
1701
|
why: `The connected database reports no name, and the target id "${targetId}" yields none either, so the consent prompt has nothing to ask you to type and the destructive operations cannot be authorised.`,
|
|
1702
1702
|
nextActions: [{
|
|
1703
1703
|
kind: "user-choice",
|
|
1704
|
-
label: "Name the database in `db.connection` (or pass `--db <url>`) and run `
|
|
1704
|
+
label: "Name the database in `db.connection` (or pass `--db <url>`) and run `{bin} db update` again."
|
|
1705
1705
|
}]
|
|
1706
1706
|
});
|
|
1707
1707
|
}
|
|
@@ -1712,7 +1712,7 @@ function errorConsentOperationsMissing() {
|
|
|
1712
1712
|
nextActions: [{
|
|
1713
1713
|
kind: "run-command",
|
|
1714
1714
|
label: "Preview the plan",
|
|
1715
|
-
command: "
|
|
1715
|
+
command: "{bin} db update --dry-run"
|
|
1716
1716
|
}]
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
@@ -1748,7 +1748,7 @@ function updatePresentations(inputs) {
|
|
|
1748
1748
|
]
|
|
1749
1749
|
}, ...migrationResultBlocks(document)],
|
|
1750
1750
|
json: () => document,
|
|
1751
|
-
next: () => migrationResultNextActions(document, "
|
|
1751
|
+
next: () => migrationResultNextActions(document, "{bin} db update")
|
|
1752
1752
|
};
|
|
1753
1753
|
}
|
|
1754
1754
|
function updateDocument(inputs) {
|
|
@@ -1981,7 +1981,7 @@ function combineVerifyResults(perSpace, appSpaceId, strict, unclaimed) {
|
|
|
1981
1981
|
* diagnostics rather than an error.
|
|
1982
1982
|
*/
|
|
1983
1983
|
const FINDINGS_EXIT_CODE$1 = 4;
|
|
1984
|
-
const PUSH_THE_CONTRACT = runCommandAction("Push the contract to the database", "
|
|
1984
|
+
const PUSH_THE_CONTRACT = runCommandAction("Push the contract to the database", "{bin} db update");
|
|
1985
1985
|
const RECONCILE_BY_HAND = {
|
|
1986
1986
|
kind: "user-choice",
|
|
1987
1987
|
label: "Or reconcile the differences by hand and verify again"
|
|
@@ -2498,7 +2498,7 @@ function createFormatCommand(execute = executeFormat) {
|
|
|
2498
2498
|
help: {
|
|
2499
2499
|
summary: "Format your PSL contract source",
|
|
2500
2500
|
description: "Formats the Prisma schema (PSL) contract source declared in your config\n(contract.source.inputs[0]) in place. Only runs when contract.source.format\nis 'psl'; a TypeScript or unset source is left untouched. Indent and newline\nare read from the optional formatter config section, defaulting to two\nspaces and the system newline.",
|
|
2501
|
-
examples: ["format", "format --json"]
|
|
2501
|
+
examples: ["contract format", "contract format --json"]
|
|
2502
2502
|
},
|
|
2503
2503
|
needs: { config: ormConfigSection },
|
|
2504
2504
|
handler: async (_args, ctx) => {
|
|
@@ -3968,7 +3968,7 @@ function mergePackageScripts(existing, required = REQUIRED_SCRIPTS) {
|
|
|
3968
3968
|
mutated = true;
|
|
3969
3969
|
continue;
|
|
3970
3970
|
}
|
|
3971
|
-
if (existingValue !== command) warnings.push(`package.json already has a "${name}" script with a different command — keeping yours.\n existing: ${existingValue}\n expected: ${command}\nIf you want the default, remove your "${name}" script and re-run \`init\`.`);
|
|
3971
|
+
if (existingValue !== command) warnings.push(`package.json already has a "${name}" script with a different command — keeping yours.\n existing: ${existingValue}\n expected: ${command}\nIf you want the default, remove your "${name}" script and re-run \`orm init\`.`);
|
|
3972
3972
|
}
|
|
3973
3973
|
if (!mutated) return {
|
|
3974
3974
|
content: null,
|
|
@@ -4942,12 +4942,12 @@ const createInitCommand = (injected) => defineOrmCommand({
|
|
|
4942
4942
|
summary: "Initialize a new Prisma Next project",
|
|
4943
4943
|
description: "Scaffolds config, schema, and runtime files, installs dependencies,\nand emits the contract. Gets you from zero to typed queries in one step.\n\nRun it interactively for a guided setup, or supply --target and --authoring\nfor a fully scriptable run (CI, AI coding agents, automation).",
|
|
4944
4944
|
examples: [
|
|
4945
|
-
"init",
|
|
4946
|
-
"init --target postgres --authoring psl",
|
|
4947
|
-
"init --target mongodb --authoring typescript --json",
|
|
4948
|
-
"init --skip-install",
|
|
4949
|
-
"init --skip-skills",
|
|
4950
|
-
"init --target postgres --keep-previous-facade"
|
|
4945
|
+
"orm init",
|
|
4946
|
+
"orm init --target postgres --authoring psl",
|
|
4947
|
+
"orm init --target mongodb --authoring typescript --json",
|
|
4948
|
+
"orm init --skip-install",
|
|
4949
|
+
"orm init --skip-skills",
|
|
4950
|
+
"orm init --target postgres --keep-previous-facade"
|
|
4951
4951
|
]
|
|
4952
4952
|
},
|
|
4953
4953
|
args: { flags: {
|
|
@@ -7403,12 +7403,12 @@ function mapMigrateFailure(failure) {
|
|
|
7403
7403
|
if (failure.code === "MIGRATION_PATH_NOT_FOUND") return errorPathUnreachable(failure);
|
|
7404
7404
|
return errorRunnerFailed(failure.summary, {
|
|
7405
7405
|
why: failure.why ?? "Migration runner failed",
|
|
7406
|
-
fix: "Fix the issue and re-run `
|
|
7406
|
+
fix: "Fix the issue and re-run `{bin} db migrate --to <contract>` — previously applied migrations are preserved.",
|
|
7407
7407
|
meta: failure.meta ?? {},
|
|
7408
7408
|
...ifDefined("cause", failure.cause)
|
|
7409
7409
|
});
|
|
7410
7410
|
}
|
|
7411
|
-
const STATUS_ACTION = runCommandAction("Check every space against the database", "
|
|
7411
|
+
const STATUS_ACTION = runCommandAction("Check every space against the database", "{bin} migration status");
|
|
7412
7412
|
/**
|
|
7413
7413
|
* The route the migration will take. The graph is a drawing — the engine cannot
|
|
7414
7414
|
* derive a lane gutter — and the ordered list under it is drawn with the same
|
|
@@ -7540,11 +7540,11 @@ function createMigrateCommand(createClient) {
|
|
|
7540
7540
|
summary: "Apply planned migrations to advance the database",
|
|
7541
7541
|
description: "Walks every contract space (app + extensions) and applies pending on-disk\nmigrations in canonical order (extensions alphabetically, then app). It\nreplays the on-disk migration graph and never invents an edge. Use --to to\ntarget a specific contract (hash, ref name, or migration directory) and\n--show for a read-only preview of the route it would take.",
|
|
7542
7542
|
examples: [
|
|
7543
|
-
"migrate",
|
|
7544
|
-
"migrate --db $DATABASE_URL",
|
|
7545
|
-
"migrate --to production",
|
|
7546
|
-
"migrate --show",
|
|
7547
|
-
"migrate --show --from @contract --to production"
|
|
7543
|
+
"db migrate",
|
|
7544
|
+
"db migrate --db $DATABASE_URL",
|
|
7545
|
+
"db migrate --to production",
|
|
7546
|
+
"db migrate --show",
|
|
7547
|
+
"db migrate --show --from @contract --to production"
|
|
7548
7548
|
]
|
|
7549
7549
|
},
|
|
7550
7550
|
args: { flags: {
|
|
@@ -7605,7 +7605,7 @@ function createMigrateCommand(createClient) {
|
|
|
7605
7605
|
config: ctx.config,
|
|
7606
7606
|
cwd: ctx.cwd,
|
|
7607
7607
|
db: args.flags.db,
|
|
7608
|
-
commandName: "migrate",
|
|
7608
|
+
commandName: "db migrate",
|
|
7609
7609
|
createClient
|
|
7610
7610
|
});
|
|
7611
7611
|
if (!prepared.ok) return notOk$1(prepared.failure);
|
|
@@ -7786,7 +7786,7 @@ function integrityViolationToCheckFailure(violation, migrationsDir) {
|
|
|
7786
7786
|
code: "MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED",
|
|
7787
7787
|
where: spaceRelative(violation.spaceId),
|
|
7788
7788
|
why: `Extension "${violation.spaceId}" is declared in \`extensions\` but has no on-disk migrations directory.`,
|
|
7789
|
-
nextActions: [runCommandAction("Re-emit the extension contract-space artefacts, then plan its migrations", "
|
|
7789
|
+
nextActions: [runCommandAction("Re-emit the extension contract-space artefacts, then plan its migrations", "{bin} contract emit"), chooseAction("Or remove the extension from `extensions` if it is unused")]
|
|
7790
7790
|
};
|
|
7791
7791
|
case "headRefMissing": return {
|
|
7792
7792
|
space: violation.spaceId,
|
|
@@ -7828,7 +7828,7 @@ function integrityViolationToCheckFailure(violation, migrationsDir) {
|
|
|
7828
7828
|
code: "MIGRATION.CHECK_CONTRACT_UNREADABLE",
|
|
7829
7829
|
where: migrationFileRelative(join(migrationsDir, violation.spaceId), "contract.json"),
|
|
7830
7830
|
why: `Contract for space "${violation.spaceId}" is unreadable: ${violation.detail}`,
|
|
7831
|
-
nextActions: [runCommandAction("Re-emit the extension contract artefacts", "
|
|
7831
|
+
nextActions: [runCommandAction("Re-emit the extension contract artefacts", "{bin} contract emit"), chooseAction("Or fix the descriptor producing the invalid contract")]
|
|
7832
7832
|
};
|
|
7833
7833
|
case "duplicateMigrationHash": return {
|
|
7834
7834
|
space: violation.spaceId,
|
|
@@ -8599,7 +8599,7 @@ function planNextActions(result, migrationsRelative) {
|
|
|
8599
8599
|
return [{
|
|
8600
8600
|
kind: "edit-file",
|
|
8601
8601
|
label: `Review ${written.join(" and ")}`
|
|
8602
|
-
}, runCommandAction("Apply the migration", "
|
|
8602
|
+
}, runCommandAction("Apply the migration", "{bin} db migrate")];
|
|
8603
8603
|
}
|
|
8604
8604
|
function planPresentations(inputs) {
|
|
8605
8605
|
return {
|
|
@@ -8876,7 +8876,7 @@ const migrationShowCommand = defineOrmCommand({
|
|
|
8876
8876
|
} catch (error) {
|
|
8877
8877
|
return notOk$1(normalizeError(Reflect.get(Object(error), "code") === "ENOENT" ? errorFileNotFound(contractPath, {
|
|
8878
8878
|
why: `Contract file not found at ${contractPath}`,
|
|
8879
|
-
fix: `Run \`
|
|
8879
|
+
fix: `Run \`{bin} contract emit\` to generate ${relative(ctx.cwd, contractPath)}`
|
|
8880
8880
|
}) : errorUnexpected(error instanceof Error ? error.message : String(error), { why: "Failed to read contract file" })));
|
|
8881
8881
|
}
|
|
8882
8882
|
const familyInstance = ctx.config.family.create(createControlStack(ctx.config));
|
|
@@ -8942,7 +8942,7 @@ const migrationShowCommand = defineOrmCommand({
|
|
|
8942
8942
|
})));
|
|
8943
8943
|
}
|
|
8944
8944
|
});
|
|
8945
|
-
const EMIT_CONTRACT = runCommandAction("Regenerate the contract", "
|
|
8945
|
+
const EMIT_CONTRACT = runCommandAction("Regenerate the contract", "{bin} contract emit");
|
|
8946
8946
|
function contractUnreadableFinding(reason) {
|
|
8947
8947
|
const message = `Could not read contract: ${reason}`;
|
|
8948
8948
|
return {
|
|
@@ -8950,7 +8950,7 @@ function contractUnreadableFinding(reason) {
|
|
|
8950
8950
|
code: "CONTRACT.UNREADABLE",
|
|
8951
8951
|
severity: "warn",
|
|
8952
8952
|
message,
|
|
8953
|
-
hints: ["Run '
|
|
8953
|
+
hints: ["Run '{bin} contract emit' to generate a valid contract"]
|
|
8954
8954
|
},
|
|
8955
8955
|
diagnostic: {
|
|
8956
8956
|
code: "CONTRACT.UNREADABLE",
|
|
@@ -8968,7 +8968,7 @@ function markerNotInHistoryFinding(space) {
|
|
|
8968
8968
|
code: "MIGRATION.MARKER_NOT_IN_HISTORY",
|
|
8969
8969
|
severity: "warn",
|
|
8970
8970
|
message,
|
|
8971
|
-
hints: ["Run '
|
|
8971
|
+
hints: ["Run '{bin} db sign' to overwrite the marker if the database already matches the contract", "Run '{bin} db update' to push the current contract to the database"]
|
|
8972
8972
|
},
|
|
8973
8973
|
diagnostic: {
|
|
8974
8974
|
code: "MIGRATION.MARKER_NOT_IN_HISTORY",
|
|
@@ -8976,7 +8976,7 @@ function markerNotInHistoryFinding(space) {
|
|
|
8976
8976
|
summary: message,
|
|
8977
8977
|
why: "The marker the database carries names no contract in the on-disk migration graph.",
|
|
8978
8978
|
meta: { space },
|
|
8979
|
-
nextActions: [runCommandAction("Overwrite the marker if the database already matches the contract", "
|
|
8979
|
+
nextActions: [runCommandAction("Overwrite the marker if the database already matches the contract", "{bin} db sign"), runCommandAction("Or push the current contract to the database", "{bin} db update")]
|
|
8980
8980
|
}
|
|
8981
8981
|
};
|
|
8982
8982
|
}
|
|
@@ -8995,7 +8995,7 @@ function missingInvariantsFinding(inputs) {
|
|
|
8995
8995
|
severity: "warn",
|
|
8996
8996
|
summary: message,
|
|
8997
8997
|
why: inputs.refName === void 0 ? "The database marker does not carry every invariant the target requires." : `The database marker does not carry every invariant \`${inputs.refName}\` requires.`,
|
|
8998
|
-
nextActions: [runCommandAction("Apply the migrations that provide them", "
|
|
8998
|
+
nextActions: [runCommandAction("Apply the migrations that provide them", "{bin} db migrate")],
|
|
8999
8999
|
meta: {
|
|
9000
9000
|
invariants: [...inputs.missing],
|
|
9001
9001
|
...ifDefined("ref", inputs.refName)
|
|
@@ -9031,13 +9031,13 @@ async function readDatabaseState(inputs) {
|
|
|
9031
9031
|
function buildNoPathSummary(args) {
|
|
9032
9032
|
const markerPart = args.markerHash !== void 0 ? `the database state (${shortDisplayHash(args.markerHash)})` : "the database state";
|
|
9033
9033
|
const targetShort = shortDisplayHash(args.targetHash);
|
|
9034
|
-
if (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \`
|
|
9035
|
-
return `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \`${args.refName}\`)` : `the target (${targetShort})`}. Run \`
|
|
9034
|
+
if (!args.explicitTarget) return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \`{bin} migration plan --name <name>\` to author one.`;
|
|
9035
|
+
return `No migration path from ${markerPart} to ${args.refName !== void 0 ? `the target (${targetShort} via \`${args.refName}\`)` : `the target (${targetShort})`}. Run \`{bin} migration plan --name <name>\` to author one, or pass \`--to <contract>\` to pick a reachable target.`;
|
|
9036
9036
|
}
|
|
9037
9037
|
function buildStatusHeadline(args) {
|
|
9038
9038
|
if (args.markerDiverged && args.markerHash !== void 0) return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;
|
|
9039
9039
|
if (args.pendingCount === 0) return "Up to date";
|
|
9040
|
-
return `${args.pendingCount} pending — run \`
|
|
9040
|
+
return `${args.pendingCount} pending — run \`{bin} db migrate --to ${shortDisplayHash(args.targetHash)}\``;
|
|
9041
9041
|
}
|
|
9042
9042
|
/**
|
|
9043
9043
|
* One space's section: its heading, where more than one space is in scope, on
|
|
@@ -9141,7 +9141,7 @@ const migrationStatusCommand = defineOrmCommand({
|
|
|
9141
9141
|
dbConnection,
|
|
9142
9142
|
hasDriver,
|
|
9143
9143
|
why: "migration status needs a database connection to read the marker and ledger (or pass --from for an offline path preview)",
|
|
9144
|
-
retryCommand: "
|
|
9144
|
+
retryCommand: "{bin} migration status --from <contract>"
|
|
9145
9145
|
});
|
|
9146
9146
|
if (missingDb !== null) return notOk$1(normalizeError(missingDb));
|
|
9147
9147
|
}
|
|
@@ -9388,7 +9388,7 @@ function createRefDeleteCommand(execute = executeRefDeleteCommand) {
|
|
|
9388
9388
|
help: {
|
|
9389
9389
|
summary: "Delete a ref",
|
|
9390
9390
|
description: "Removes migrations/app/refs/<name>.json. The contract the ref pointed at\nis untouched: a ref is a pointer, and its target survives the deletion.",
|
|
9391
|
-
examples: ["ref delete staging", "ref delete staging --json"]
|
|
9391
|
+
examples: ["migration ref delete staging", "migration ref delete staging --json"]
|
|
9392
9392
|
},
|
|
9393
9393
|
args: { positionals: { name: positional.string({
|
|
9394
9394
|
brief: "Ref name to delete",
|
|
@@ -9454,7 +9454,7 @@ function createRefListCommand(execute = executeRefListCommand) {
|
|
|
9454
9454
|
help: {
|
|
9455
9455
|
summary: "List every named ref",
|
|
9456
9456
|
description: "Reads migrations/app/refs/ and reports each ref with the contract hash it\npoints at and the invariants recorded against it. Offline — does not\nconsult the database.",
|
|
9457
|
-
examples: ["ref list", "ref list --json"]
|
|
9457
|
+
examples: ["migration ref list", "migration ref list --json"]
|
|
9458
9458
|
},
|
|
9459
9459
|
needs: { config: ormConfigSection },
|
|
9460
9460
|
handler: async (_args, ctx) => {
|
|
@@ -9497,9 +9497,9 @@ function createRefSetCommand(execute = executeRefSetCommand) {
|
|
|
9497
9497
|
summary: "Point a ref at a contract",
|
|
9498
9498
|
description: "Writes migrations/app/refs/<name>.json so a logical environment name\nresolves to a contract hash. The contract is given as a hash or prefix,\nanother ref name, a migration directory name, or <dir>^ for that\nmigration's source contract. Offline — the contract must already be a\nnode of the on-disk migration graph, with its snapshot present.",
|
|
9499
9499
|
examples: [
|
|
9500
|
-
"ref set staging 4cb4256",
|
|
9501
|
-
"ref set production 20260101T1000_add_user",
|
|
9502
|
-
"ref set staging production --json"
|
|
9500
|
+
"migration ref set staging 4cb4256",
|
|
9501
|
+
"migration ref set production 20260101T1000_add_user",
|
|
9502
|
+
"migration ref set staging production --json"
|
|
9503
9503
|
]
|
|
9504
9504
|
},
|
|
9505
9505
|
args: { positionals: {
|
|
@@ -9538,40 +9538,35 @@ const ormCommandFamily = defineCommandFamily({
|
|
|
9538
9538
|
configSection: ormConfigSection,
|
|
9539
9539
|
commands: {
|
|
9540
9540
|
"contract emit": contractEmitCommand,
|
|
9541
|
+
"contract format": formatCommand,
|
|
9541
9542
|
"contract infer": contractInferCommand,
|
|
9542
9543
|
"db init": dbInitCommand,
|
|
9544
|
+
"db migrate": migrateCommand,
|
|
9543
9545
|
"db schema": dbSchemaCommand,
|
|
9544
9546
|
"db sign": dbSignCommand,
|
|
9545
9547
|
"db update": dbUpdateCommand,
|
|
9546
9548
|
"db verify": dbVerifyCommand,
|
|
9547
|
-
format: formatCommand,
|
|
9548
|
-
init: initCommand,
|
|
9549
9549
|
lsp: lspCommand,
|
|
9550
|
-
migrate: migrateCommand,
|
|
9551
9550
|
"migration check": migrationCheckCommand,
|
|
9552
9551
|
"migration graph": migrationGraphCommand,
|
|
9553
9552
|
"migration list": migrationListCommand,
|
|
9554
9553
|
"migration log": migrationLogCommand,
|
|
9555
9554
|
"migration new": migrationNewCommand,
|
|
9556
9555
|
"migration plan": migrationPlanCommand,
|
|
9556
|
+
"migration ref delete": refDeleteCommand,
|
|
9557
|
+
"migration ref list": refListCommand,
|
|
9558
|
+
"migration ref set": refSetCommand,
|
|
9557
9559
|
"migration show": migrationShowCommand,
|
|
9558
9560
|
"migration status": migrationStatusCommand,
|
|
9559
|
-
"
|
|
9560
|
-
"ref list": refListCommand,
|
|
9561
|
-
"ref set": refSetCommand
|
|
9561
|
+
"orm init": initCommand
|
|
9562
9562
|
},
|
|
9563
9563
|
docsBaseUrl: DOCS_BASE_URL,
|
|
9564
9564
|
redirects: [
|
|
9565
9565
|
{
|
|
9566
9566
|
from: "migration apply",
|
|
9567
|
-
replacement: "{bin} migrate --to <contract>",
|
|
9567
|
+
replacement: "{bin} db migrate --to <contract>",
|
|
9568
9568
|
reason: "Applying a migration is a move to a target contract, not a verb of its own."
|
|
9569
9569
|
},
|
|
9570
|
-
{
|
|
9571
|
-
from: "migration ref",
|
|
9572
|
-
replacement: "{bin} ref set|list|delete",
|
|
9573
|
-
reason: "Refs are managed by their own command, for every space rather than migrations alone."
|
|
9574
|
-
},
|
|
9575
9570
|
{
|
|
9576
9571
|
from: "migration status",
|
|
9577
9572
|
flag: "graph",
|