diff --git a/apps/lsp-playground/package.json b/apps/lsp-playground/package.json index 264001a3b7db..5f0bf645d225 100644 --- a/apps/lsp-playground/package.json +++ b/apps/lsp-playground/package.json @@ -35,7 +35,7 @@ "ws": "^8.21.2" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/apps/telemetry-backend/package.json b/apps/telemetry-backend/package.json index 1e1363f21435..148371667072 100644 --- a/apps/telemetry-backend/package.json +++ b/apps/telemetry-backend/package.json @@ -27,7 +27,7 @@ "evlog": "^2.24.0" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/compute-sdk": "^0.43.0", "@prisma/management-api-sdk": "^1.76.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", diff --git a/docs/architecture docs/subsystems/7. Migration System.md b/docs/architecture docs/subsystems/7. Migration System.md index 97ecf60f3cd8..f60036021da9 100644 --- a/docs/architecture docs/subsystems/7. Migration System.md +++ b/docs/architecture docs/subsystems/7. Migration System.md @@ -742,7 +742,7 @@ There is no core sandbox-execution verb. An earlier design proposed `migration p ### Removed-verb redirects -The CLI maintains a small lookup table for removed verbs and for the Prisma 7 `migrate` commands, and emits a targeted suggestion when one is invoked. Each redirect also gives a short reason. The reasons for `migrate dev`, `migrate deploy`, `migrate status`, `migrate reset` and `migrate resolve` also say to run the Prisma 7 command with Prisma 7's CLI while Prisma 7 still owns the project's migrations; `migrate diff` does not, because its replacement, `db update --dry-run`, only reads: +The CLI maintains a small lookup table for removed verbs and for the Prisma 7 commands the ORM owns, and emits a targeted suggestion when one is invoked. Each redirect also gives a short reason. Every Prisma 7 command's reason ends with how to install Prisma 7's CLI (`npm install --save-dev @prisma/prisma7@7`) and run the command with it, as a command line that runs once its placeholders are filled in: `prisma7 `, with a placeholder for every value Prisma 7 requires, such as `prisma7 migrate resolve --applied `, `prisma7 db execute --file ` and `prisma7 migrate diff --from-config-datasource --to-schema `. For `migrate dev`, `migrate deploy`, `migrate status`, `migrate reset` and `migrate resolve` that sentence applies while Prisma 7 still owns the project's migrations. `migrate diff` gives it without the condition, because its replacement, `db update --dry-run`, only reads; the other Prisma 7 commands give it without the condition too: | Old invocation | Replacement | |---|---| @@ -750,14 +750,22 @@ The CLI maintains a small lookup table for removed verbs and for the Prisma 7 `m | `prisma migration status` with `--graph` | `prisma migration graph` | | `prisma migration status` with `--all` or `--limit` | `prisma migration log --db ` | | `prisma migration status` with `--ref X` | `prisma migration status --to X` | -| `prisma migrate dev` (Prisma 7) | `prisma contract emit`; the reason names the next steps, `migration plan --name ` and `db migrate --advance-ref db` | +| `prisma migrate dev` (Prisma 7) | three steps: `prisma contract emit`, `prisma migration plan --name `, then `prisma db migrate --advance-ref db` | | `prisma migrate deploy` (Prisma 7) | `prisma db migrate` | | `prisma migrate status` (Prisma 7) | `prisma migration status` | | `prisma migrate diff` (Prisma 7) | `prisma db update --dry-run`, which applies nothing; the reason names `migration plan` for a migration package | | `prisma migrate reset` (Prisma 7) | `prisma db update`; the reason says Prisma 8 has no reset, and that a database that changes only through migrations is moved with `db migrate` instead | | `prisma migrate resolve` (Prisma 7) | `prisma db sign ` (moves the marker; `migration status` shows no applied mark) | - -The table lives in [`family.ts`](../../../packages/1-framework/3-tooling/cli/src/orm/family.ts). The CLI engine intercepts each retired invocation before it runs, exits `2` with `CLI.COMMAND_MOVED`, and names the replacement as a next action, with the shell's own binary name in place of `prisma`. +| `prisma generate` (Prisma 7) | `prisma contract emit` | +| `prisma validate` (Prisma 7) | none; the CLI docs, and the reason says `contract emit` reports an invalid schema | +| `prisma format` (Prisma 7) | `prisma contract format` | +| `prisma studio` (Prisma 7) | none; the CLI docs | +| `prisma db pull` (Prisma 7) | `prisma contract infer` | +| `prisma db push` (Prisma 7) | `prisma db update`; the reason names `db init` for a new database | +| `prisma db seed` (Prisma 7) | none; the CLI docs | +| `prisma db execute` (Prisma 7) | none; the CLI docs | + +The table is in [`family.ts`](../../../packages/1-framework/3-tooling/cli/src/orm/family.ts). The CLI engine intercepts each retired invocation before it runs, exits `2` with `CLI.COMMAND_MOVED` for a removed verb or `CLI.V7_COMMAND` for a Prisma 7 command, and names the replacement as a next action, with the shell's own binary name in place of `prisma`. A Prisma 7 command also names the replacement's `--help`, or links the CLI docs when it has no replacement. ### `--advance-ref` flag family diff --git a/docs/reference/error-reference.md b/docs/reference/error-reference.md index abf14f3aec33..ac6ff67ad9aa 100644 --- a/docs/reference/error-reference.md +++ b/docs/reference/error-reference.md @@ -239,6 +239,10 @@ Catch-all for an unanticipated failure inside a CLI command: an unclassified exc The migration-file CLI (`prisma migration`) received a flag it does not recognise; wraps clipanion's unknown-syntax error at the parser boundary so consumers can build "did you mean" suggestions from meta instead of parsing the message. Payload: `flag`, `knownFlags`. +### CLI.V7_COMMAND + +Settled by `@prisma/cli-engine` from the redirect table in `family.ts`, not raised by a command: the user typed a Prisma 7 command path that Prisma 8 does not have, such as `prisma generate`, `prisma db push` or `prisma migrate dev`; instead of failing as unknown, the run settles with the summary "`prisma ` is a Prisma 7 command and is not available in Prisma 8". `why` says what the suggested Prisma 8 commands do and what they do not cover, and ends with how to install Prisma 7's CLI (`npm install --save-dev @prisma/prisma7@7`) and run the same command as `prisma7 `, with a placeholder for every value Prisma 7 requires (for example `prisma7 db execute --file `); for the `migrate` commands except `migrate diff`, that sentence applies while Prisma 7 still owns the project's migrations. Next actions, in order: the replacement commands as run-command actions (labelled "Use the replacement" for one, "Step 1", "Step 2", … for several), a run-command pointing at the suggested command's `--help`, and an open-url action to the CLI docs when Prisma 8 has no equivalent. The engine's entry is the reference: [CLI.V7_COMMAND](https://docs.prisma.io/docs/cli/error-reference#CLI.V7_COMMAND). Exits 2. Payload: none. + ## CONTRACT ### CONTRACT.ARGUMENT_INVALID diff --git a/examples/bundle-size/package.json b/examples/bundle-size/package.json index e1280a1c6cfb..a4df21afae91 100644 --- a/examples/bundle-size/package.json +++ b/examples/bundle-size/package.json @@ -28,7 +28,7 @@ "pg": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/dev": "catalog:", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", diff --git a/examples/mongo-blog-leaderboard/package.json b/examples/mongo-blog-leaderboard/package.json index e325b37f2845..06a8036cb63f 100644 --- a/examples/mongo-blog-leaderboard/package.json +++ b/examples/mongo-blog-leaderboard/package.json @@ -19,7 +19,7 @@ "mongodb": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/examples/mongo-demo/package.json b/examples/mongo-demo/package.json index 4abd831eb50a..2b05decff88c 100644 --- a/examples/mongo-demo/package.json +++ b/examples/mongo-demo/package.json @@ -24,7 +24,7 @@ "react-dom": "^19.2.8" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/examples/multi-extension-monorepo/package.json b/examples/multi-extension-monorepo/package.json index 26c834d58a39..423fd4fe9815 100644 --- a/examples/multi-extension-monorepo/package.json +++ b/examples/multi-extension-monorepo/package.json @@ -18,7 +18,7 @@ "@prisma/orm-postgres": "workspace:8.0.0-rc.23" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/examples/paradedb-demo/package.json b/examples/paradedb-demo/package.json index 14baa9e9db15..f39881337a6f 100644 --- a/examples/paradedb-demo/package.json +++ b/examples/paradedb-demo/package.json @@ -25,7 +25,7 @@ "pg": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/examples/prisma-8-cloudflare-worker/package.json b/examples/prisma-8-cloudflare-worker/package.json index 8e99b57967e4..78cd65bdd722 100644 --- a/examples/prisma-8-cloudflare-worker/package.json +++ b/examples/prisma-8-cloudflare-worker/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@cloudflare/vitest-pool-workers": "0.20.3", "@cloudflare/workers-types": "5.20260804.1", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/examples/prisma-8-demo-mariadb/package.json b/examples/prisma-8-demo-mariadb/package.json index 639cae8076af..fc65c450c32b 100644 --- a/examples/prisma-8-demo-mariadb/package.json +++ b/examples/prisma-8-demo-mariadb/package.json @@ -20,7 +20,7 @@ "@prisma/orm-mariadb": "workspace:8.0.0-rc.23" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/examples/prisma-8-demo-mysql/package.json b/examples/prisma-8-demo-mysql/package.json index 0f0023e4c41f..3c4c232ee120 100644 --- a/examples/prisma-8-demo-mysql/package.json +++ b/examples/prisma-8-demo-mysql/package.json @@ -20,7 +20,7 @@ "@prisma/orm-mysql": "workspace:8.0.0-rc.23" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/examples/prisma-8-demo-sqlite/package.json b/examples/prisma-8-demo-sqlite/package.json index 3a7da2de5a25..621b4ab07061 100644 --- a/examples/prisma-8-demo-sqlite/package.json +++ b/examples/prisma-8-demo-sqlite/package.json @@ -21,7 +21,7 @@ "dotenv": "^17.4.2" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@types/node": "catalog:", diff --git a/examples/prisma-8-demo/package.json b/examples/prisma-8-demo/package.json index 3100d19a2d07..9f3b8c21a644 100644 --- a/examples/prisma-8-demo/package.json +++ b/examples/prisma-8-demo/package.json @@ -32,7 +32,7 @@ "react-dom": "^19.2.8" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/dev": "catalog:", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", diff --git a/examples/prisma-8-postgis-demo/package.json b/examples/prisma-8-postgis-demo/package.json index 65df8059dc07..b4af0cd8a515 100644 --- a/examples/prisma-8-postgis-demo/package.json +++ b/examples/prisma-8-postgis-demo/package.json @@ -33,7 +33,7 @@ "react-leaflet": "^5.0.0" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/examples/prisma7-adoption/package.json b/examples/prisma7-adoption/package.json index 19428775e7a1..4ac99d280d07 100644 --- a/examples/prisma7-adoption/package.json +++ b/examples/prisma7-adoption/package.json @@ -29,7 +29,7 @@ "pg": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/dev": "catalog:", "@prisma/prisma7": "7.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", diff --git a/examples/react-router-demo/package.json b/examples/react-router-demo/package.json index 0dbc66495d9e..ae9093e4d6f7 100644 --- a/examples/react-router-demo/package.json +++ b/examples/react-router-demo/package.json @@ -30,7 +30,7 @@ "react-router": "^8.1.0" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/dev": "catalog:", "@react-router/dev": "^8.1.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", diff --git a/examples/retail-store/package.json b/examples/retail-store/package.json index 29e93158ddb9..bbbc1e8071cc 100644 --- a/examples/retail-store/package.json +++ b/examples/retail-store/package.json @@ -39,7 +39,7 @@ "tailwindcss": "^4.3.3" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/examples/supabase/package.json b/examples/supabase/package.json index 9981c650dc45..a63b5d106be0 100644 --- a/examples/supabase/package.json +++ b/examples/supabase/package.json @@ -18,7 +18,7 @@ "pg": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/prisma-bin": "workspace:8.0.0-rc.23", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", diff --git a/packages/1-framework/3-tooling/cli/package.json b/packages/1-framework/3-tooling/cli/package.json index 799266b1bdad..249da2a8cb36 100644 --- a/packages/1-framework/3-tooling/cli/package.json +++ b/packages/1-framework/3-tooling/cli/package.json @@ -52,7 +52,7 @@ "@internal/sql-contract-ts": "workspace:8.0.0-rc.23", "@internal/sql-operations": "workspace:8.0.0-rc.23", "@internal/sql-runtime": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", @@ -62,7 +62,7 @@ "vitest": "catalog:" }, "peerDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "typescript": ">=5.9" }, "peerDependenciesMeta": { diff --git a/packages/1-framework/3-tooling/cli/src/orm/family.ts b/packages/1-framework/3-tooling/cli/src/orm/family.ts index d8aa32fbd84b..70f8155eda81 100644 --- a/packages/1-framework/3-tooling/cli/src/orm/family.ts +++ b/packages/1-framework/3-tooling/cli/src/orm/family.ts @@ -58,8 +58,34 @@ const commands: Readonly> = { 'orm init': initCommand, }; +const CLI_DOCS_URL = 'https://www.prisma.io/docs/cli'; + +const PRISMA_7_INSTALL = 'install its CLI with `npm install --save-dev @prisma/prisma7@7`'; + +function v7Command( + from: string, + entry: Omit & { + readonly reason: string; + readonly whileMigrationsStayOnPrisma7?: boolean; + readonly prisma7Invocation?: string; + }, +): RedirectSpec { + const { whileMigrationsStayOnPrisma7, prisma7Invocation, reason, ...rest } = entry; + const invocation = `prisma7 ${prisma7Invocation ?? from}`; + const prisma7 = whileMigrationsStayOnPrisma7 + ? `While Prisma 7 still owns this project's migrations, ${PRISMA_7_INSTALL} and run \`${invocation}\` instead.` + : `To keep using Prisma 7, ${PRISMA_7_INSTALL} and run \`${invocation}\`.`; + return { + from, + code: 'CLI.V7_COMMAND', + summary: `\`{bin} ${from}\` is a Prisma 7 command and is not available in Prisma 8`, + reason: `${reason} ${prisma7}`, + ...rest, + }; +} + /** - * The invocations the ORM retired, and the Prisma 7 `migrate` commands, so an old command line gets the replacement rather than a spelling suggestion. Replacements name the binary as `{bin}`; the engine substitutes the shell's own name. + * The invocations the ORM retired, and the Prisma 7 commands, so an old command line gets the replacement or a link to the docs rather than a spelling suggestion. Replacements name the binary as `{bin}`; the engine substitutes the shell's own name. * * The four flag redirects name `migration status`, which the engine requires to be a mounted command. */ @@ -93,42 +119,93 @@ const redirects: readonly RedirectSpec[] = [ replacement: '{bin} migration status --to ', reason: 'One flag names the target contract, whether it is a ref, a hash or a migration.', }, - { - from: 'migrate dev', - replacement: '{bin} contract emit', + v7Command('migrate dev', { + replacement: [ + '{bin} contract emit', + '{bin} migration plan --name ', + '{bin} db migrate --advance-ref db', + ], reason: - "Prisma 8 emits the contract, plans the migration and applies it in separate steps: run `contract emit`, then `migration plan --name ` (for `--create-only`, stop here), then `db migrate --advance-ref db`; while Prisma 7 still owns this project's migrations, run `migrate dev` with Prisma 7's CLI instead.", - }, - { - from: 'migrate deploy', + 'Prisma 8 emits the contract, plans the migration and applies it in separate steps: run `contract emit`, then `migration plan --name ` (for `--create-only`, stop here), then `db migrate --advance-ref db`.', + whileMigrationsStayOnPrisma7: true, + help: 'contract emit', + }), + v7Command('migrate deploy', { replacement: '{bin} db migrate', - reason: - "`db migrate` applies the planned migrations; while Prisma 7 still owns this project's migrations, run `migrate deploy` with Prisma 7's CLI instead.", - }, - { - from: 'migrate status', + reason: '`db migrate` applies the planned migrations.', + whileMigrationsStayOnPrisma7: true, + help: 'db migrate', + }), + v7Command('migrate status', { replacement: '{bin} migration status', - reason: - "`migration status` reports which planned migrations the database has applied; while Prisma 7 still owns this project's migrations, run `migrate status` with Prisma 7's CLI instead.", - }, - { - from: 'migrate diff', + reason: '`migration status` reports which planned migrations the database has applied.', + whileMigrationsStayOnPrisma7: true, + help: 'migration status', + }), + v7Command('migrate diff', { replacement: '{bin} db update --dry-run', reason: '`db update --dry-run` prints the changes between the contract and a live database without applying them; to write the changes between two contracts as a migration package use `migration plan`, and to report drift use `db verify`.', - }, - { - from: 'migrate reset', + prisma7Invocation: 'migrate diff --from-config-datasource --to-schema ', + help: 'db update', + }), + v7Command('migrate reset', { replacement: '{bin} db update', reason: - "Prisma 8 has no reset: `db update` moves the database to the contract without a reset and asks before losing data, on a database whose migration history does not need to be kept; a database that changes only through migrations is moved with `db migrate`; while Prisma 7 still owns this project's migrations, run `migrate reset` with Prisma 7's CLI instead.", - }, - { - from: 'migrate resolve', + 'Prisma 8 has no reset: `db update` moves the database to the contract without a reset and asks before losing data, on a database whose migration history does not need to be kept; a database that changes only through migrations is moved with `db migrate`.', + whileMigrationsStayOnPrisma7: true, + help: 'db update', + }), + v7Command('migrate resolve', { replacement: '{bin} db sign ', reason: - "`db sign ` checks that the database already has that migration's schema and moves the database marker to that migration's contract, so `db migrate` continues after it; `migration status` does not list the migration as applied. Use it where you would run `migrate resolve --applied` after applying a migration's changes by hand. While Prisma 7 still owns this project's migrations, run `migrate resolve` with Prisma 7's CLI instead.", - }, + "`db sign ` checks that the database already has that migration's schema and moves the database marker to that migration's contract, so `db migrate` continues after it; `migration status` does not list the migration as applied. Use it where you would run `migrate resolve --applied` after applying a migration's changes by hand.", + whileMigrationsStayOnPrisma7: true, + prisma7Invocation: 'migrate resolve --applied ', + help: 'db sign', + }), + v7Command('generate', { + replacement: '{bin} contract emit', + help: 'contract emit', + reason: + 'Prisma 8 has no client generation step. `contract emit` reads your schema and writes contract.json and contract.d.ts, the contract files the ORM reads to know your data model and its types.', + }), + v7Command('validate', { + docsUrl: CLI_DOCS_URL, + reason: + 'Prisma 8 has no separate validate command. `contract emit` reports an invalid schema when it runs, and writes the contract files when the schema is valid.', + }), + v7Command('format', { + replacement: '{bin} contract format', + help: 'contract format', + reason: + '`contract format` formats the PSL schema files your prisma.config.ts names as the contract source, in place. It leaves a schema written in TypeScript untouched.', + }), + v7Command('studio', { + docsUrl: CLI_DOCS_URL, + reason: 'Prisma 8 has no Studio command for browsing and editing your data in a browser.', + }), + v7Command('db pull', { + replacement: '{bin} contract infer', + help: 'contract infer', + reason: + '`contract infer` reads the live database, named with `--db `, and writes its schema as a PSL contract file. Run `contract emit` afterwards to write the contract files the ORM reads, then `db sign` to record that the database matches the contract, so queries can run against it.', + }), + v7Command('db push', { + replacement: '{bin} db update', + help: 'db update', + reason: + '`db update` changes the database to match the contract directly, without migration files, and asks before any change that would lose data. On a new database, `db init` creates what the contract declares and never removes or changes anything already there. Both read the contract files `contract emit` writes, so run `contract emit` after changing the schema.', + }), + v7Command('db seed', { + docsUrl: CLI_DOCS_URL, + reason: 'Prisma 8 has no seed command. Run your seed script directly, for example with node.', + }), + v7Command('db execute', { + docsUrl: CLI_DOCS_URL, + prisma7Invocation: 'db execute --file ', + reason: 'Prisma 8 has no command that runs a script file of statements against the database.', + }), ]; /** diff --git a/packages/1-framework/3-tooling/cli/test/orm/cli.test.ts b/packages/1-framework/3-tooling/cli/test/orm/cli.test.ts index 5579c0db9806..1e1d00a6cc41 100644 --- a/packages/1-framework/3-tooling/cli/test/orm/cli.test.ts +++ b/packages/1-framework/3-tooling/cli/test/orm/cli.test.ts @@ -71,7 +71,7 @@ describe('the orm command family', () => { expect(ormCommandFamily.docsBaseUrl?.endsWith('/')).toBe(true); }); - it('retires the removed verb, the four removed status flags and the Prisma 7 migrate commands, naming the binary as {bin}', () => { + it('retires the removed verb, the four removed status flags and the Prisma 7 commands, naming the binary as {bin}', () => { expect( ormCommandFamily.redirects.map(({ from, flag, replacement }) => ({ from, @@ -82,30 +82,46 @@ describe('the orm command family', () => { { from: 'migration apply', flag: undefined, - replacement: '{bin} db migrate --to ', + replacement: ['{bin} db migrate --to '], }, - { from: 'migration status', flag: 'graph', replacement: '{bin} migration graph' }, + { from: 'migration status', flag: 'graph', replacement: ['{bin} migration graph'] }, { from: 'migration status', flag: 'all', - replacement: '{bin} migration log --db ', + replacement: ['{bin} migration log --db '], }, { from: 'migration status', flag: 'limit', - replacement: '{bin} migration log --db ', + replacement: ['{bin} migration log --db '], }, { from: 'migration status', flag: 'ref', - replacement: '{bin} migration status --to ', + replacement: ['{bin} migration status --to '], }, - { from: 'migrate dev', flag: undefined, replacement: '{bin} contract emit' }, - { from: 'migrate deploy', flag: undefined, replacement: '{bin} db migrate' }, - { from: 'migrate status', flag: undefined, replacement: '{bin} migration status' }, - { from: 'migrate diff', flag: undefined, replacement: '{bin} db update --dry-run' }, - { from: 'migrate reset', flag: undefined, replacement: '{bin} db update' }, - { from: 'migrate resolve', flag: undefined, replacement: '{bin} db sign ' }, + { + from: 'migrate dev', + flag: undefined, + replacement: [ + '{bin} contract emit', + '{bin} migration plan --name ', + '{bin} db migrate --advance-ref db', + ], + }, + { from: 'migrate deploy', flag: undefined, replacement: ['{bin} db migrate'] }, + { from: 'migrate status', flag: undefined, replacement: ['{bin} migration status'] }, + { from: 'migrate diff', flag: undefined, replacement: ['{bin} db update --dry-run'] }, + { from: 'migrate reset', flag: undefined, replacement: ['{bin} db update'] }, + { from: 'migrate resolve', flag: undefined, replacement: ['{bin} db sign '] }, + { from: 'generate', flag: undefined, replacement: ['{bin} contract emit'] }, + { from: 'validate', flag: undefined, replacement: [] }, + { from: 'format', flag: undefined, replacement: ['{bin} contract format'] }, + { from: 'studio', flag: undefined, replacement: [] }, + { from: 'db pull', flag: undefined, replacement: ['{bin} contract infer'] }, + { from: 'db push', flag: undefined, replacement: ['{bin} db update'] }, + { from: 'db seed', flag: undefined, replacement: [] }, + { from: 'db execute', flag: undefined, replacement: [] }, ]); }); }); @@ -143,6 +159,25 @@ describe("the engine's telemetry command group", () => { }); }); +const DOCS_URL = 'https://www.prisma.io/docs/cli'; + +const PRISMA_7_PLAIN = + /\. To keep using Prisma 7, install its CLI with `npm install --save-dev @prisma\/prisma7@7` and run `prisma7 [^`]+`\.$/; + +const DOCS = { kind: 'open-url', label: 'Read the docs', url: DOCS_URL }; + +function replacement(command: string) { + return { kind: 'run-command', label: 'Use the replacement', command }; +} + +function step(index: number, command: string) { + return { kind: 'run-command', label: `Step ${index}`, command }; +} + +function help(path: string) { + return { kind: 'run-command', label: 'Read its help', command: `prisma-test ${path} --help` }; +} + describe('a retired invocation', () => { it('is answered with its replacement rather than a spelling suggestion', async () => { const loader = recordingLoader(); @@ -173,50 +208,118 @@ describe('a retired invocation', () => { it.each([ { - verb: 'dev', - why: "Prisma 8 emits the contract, plans the migration and applies it in separate steps: run `contract emit`, then `migration plan --name ` (for `--create-only`, stop here), then `db migrate --advance-ref db`; while Prisma 7 still owns this project's migrations, run `migrate dev` with Prisma 7's CLI instead.", - command: 'prisma-test contract emit', + path: 'migrate dev', + why: "Prisma 8 emits the contract, plans the migration and applies it in separate steps: run `contract emit`, then `migration plan --name ` (for `--create-only`, stop here), then `db migrate --advance-ref db`. While Prisma 7 still owns this project's migrations, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate dev` instead.", + nextActions: [ + step(1, 'prisma-test contract emit'), + step(2, 'prisma-test migration plan --name '), + step(3, 'prisma-test db migrate --advance-ref db'), + help('contract emit'), + ], }, { - verb: 'deploy', - why: "`db migrate` applies the planned migrations; while Prisma 7 still owns this project's migrations, run `migrate deploy` with Prisma 7's CLI instead.", - command: 'prisma-test db migrate', + path: 'migrate deploy', + why: "`db migrate` applies the planned migrations. While Prisma 7 still owns this project's migrations, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate deploy` instead.", + nextActions: [replacement('prisma-test db migrate'), help('db migrate')], }, { - verb: 'status', - why: "`migration status` reports which planned migrations the database has applied; while Prisma 7 still owns this project's migrations, run `migrate status` with Prisma 7's CLI instead.", - command: 'prisma-test migration status', + path: 'migrate status', + why: "`migration status` reports which planned migrations the database has applied. While Prisma 7 still owns this project's migrations, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate status` instead.", + nextActions: [replacement('prisma-test migration status'), help('migration status')], }, { - verb: 'diff', - why: '`db update --dry-run` prints the changes between the contract and a live database without applying them; to write the changes between two contracts as a migration package use `migration plan`, and to report drift use `db verify`.', - command: 'prisma-test db update --dry-run', + path: 'migrate diff', + why: '`db update --dry-run` prints the changes between the contract and a live database without applying them; to write the changes between two contracts as a migration package use `migration plan`, and to report drift use `db verify`. To keep using Prisma 7, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate diff --from-config-datasource --to-schema `.', + nextActions: [replacement('prisma-test db update --dry-run'), help('db update')], }, { - verb: 'reset', - why: "Prisma 8 has no reset: `db update` moves the database to the contract without a reset and asks before losing data, on a database whose migration history does not need to be kept; a database that changes only through migrations is moved with `db migrate`; while Prisma 7 still owns this project's migrations, run `migrate reset` with Prisma 7's CLI instead.", - command: 'prisma-test db update', + path: 'migrate reset', + why: "Prisma 8 has no reset: `db update` moves the database to the contract without a reset and asks before losing data, on a database whose migration history does not need to be kept; a database that changes only through migrations is moved with `db migrate`. While Prisma 7 still owns this project's migrations, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate reset` instead.", + nextActions: [replacement('prisma-test db update'), help('db update')], }, { - verb: 'resolve', - why: "`db sign ` checks that the database already has that migration's schema and moves the database marker to that migration's contract, so `db migrate` continues after it; `migration status` does not list the migration as applied. Use it where you would run `migrate resolve --applied` after applying a migration's changes by hand. While Prisma 7 still owns this project's migrations, run `migrate resolve` with Prisma 7's CLI instead.", - command: 'prisma-test db sign ', + path: 'migrate resolve', + why: "`db sign ` checks that the database already has that migration's schema and moves the database marker to that migration's contract, so `db migrate` continues after it; `migration status` does not list the migration as applied. Use it where you would run `migrate resolve --applied` after applying a migration's changes by hand. While Prisma 7 still owns this project's migrations, install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate resolve --applied ` instead.", + nextActions: [replacement('prisma-test db sign '), help('db sign')], }, - ])('answers Prisma 7 migrate $verb with its Prisma 8 command', async ({ verb, why, command }) => { - const run = await harness(recordingLoader().loadConfig).run(['migrate', verb, '--json']); - - expect(run.exitCode).toBe(2); - expect(run.json.at(-1)).toMatchObject({ - kind: 'result', - envelope: { - ok: false, - error: { - code: 'CLI.COMMAND_MOVED', - why, - nextActions: [{ kind: 'run-command', label: 'Use the replacement', command }], + { + path: 'generate', + why: expect.stringMatching(PRISMA_7_PLAIN), + nextActions: [replacement('prisma-test contract emit'), help('contract emit')], + }, + { path: 'validate', why: expect.stringMatching(PRISMA_7_PLAIN), nextActions: [DOCS] }, + { + path: 'format', + why: expect.stringMatching(PRISMA_7_PLAIN), + nextActions: [replacement('prisma-test contract format'), help('contract format')], + }, + { path: 'studio', why: expect.stringMatching(PRISMA_7_PLAIN), nextActions: [DOCS] }, + { + path: 'db pull', + why: expect.stringMatching(PRISMA_7_PLAIN), + nextActions: [replacement('prisma-test contract infer'), help('contract infer')], + }, + { + path: 'db push', + why: expect.stringMatching(PRISMA_7_PLAIN), + nextActions: [replacement('prisma-test db update'), help('db update')], + }, + { path: 'db seed', why: expect.stringMatching(PRISMA_7_PLAIN), nextActions: [DOCS] }, + { path: 'db execute', why: expect.stringMatching(PRISMA_7_PLAIN), nextActions: [DOCS] }, + ])( + 'answers Prisma 7 $path with CLI.V7_COMMAND and what to run instead', + async ({ path, why, nextActions }) => { + const run = await harness(recordingLoader().loadConfig).run([...path.split(' '), '--json']); + + expect(run.exitCode).toBe(2); + const result = run.json.at(-1); + expect(result).toMatchObject({ + kind: 'result', + envelope: { + ok: false, + error: { + code: 'CLI.V7_COMMAND', + summary: `\`prisma-test ${path}\` is a Prisma 7 command and is not available in Prisma 8`, + why, + }, }, - }, + }); + expect( + result?.kind === 'result' && !result.envelope.ok && result.envelope.error.nextActions, + ).toEqual(nextActions); + expect(result?.kind === 'result' && result.envelope.nextActions).toEqual(nextActions); + }, + ); + + it('ends every Prisma 7 reason with a Prisma 7 command line that runs once its placeholders are filled in, never through npx', () => { + const invocations = Object.fromEntries( + ormCommandFamily.redirects + .filter(({ code }) => code === 'CLI.V7_COMMAND') + .map(({ from, reason }) => [ + from, + reason?.match(/run `(prisma7 [^`]+)`( instead)?\.$/)?.[1], + ]), + ); + + expect(invocations).toEqual({ + 'migrate dev': 'prisma7 migrate dev', + 'migrate deploy': 'prisma7 migrate deploy', + 'migrate status': 'prisma7 migrate status', + 'migrate diff': 'prisma7 migrate diff --from-config-datasource --to-schema ', + 'migrate reset': 'prisma7 migrate reset', + 'migrate resolve': 'prisma7 migrate resolve --applied ', + generate: 'prisma7 generate', + validate: 'prisma7 validate', + format: 'prisma7 format', + studio: 'prisma7 studio', + 'db pull': 'prisma7 db pull', + 'db push': 'prisma7 db push', + 'db seed': 'prisma7 db seed', + 'db execute': 'prisma7 db execute --file ', }); + for (const redirect of ormCommandFamily.redirects) { + expect(redirect.reason).not.toContain('npx'); + } }); it('answers a retired status flag with the command that replaced it', async () => { diff --git a/packages/1-framework/3-tooling/config-loader/package.json b/packages/1-framework/3-tooling/config-loader/package.json index 7c361779a6eb..a23f9802e0ed 100644 --- a/packages/1-framework/3-tooling/config-loader/package.json +++ b/packages/1-framework/3-tooling/config-loader/package.json @@ -26,7 +26,7 @@ "tinyglobby": "catalog:" }, "devDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", @@ -36,7 +36,7 @@ "vitest": "catalog:" }, "peerDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "typescript": ">=5.9" }, "peerDependenciesMeta": { diff --git a/packages/3-extensions/citext/package.json b/packages/3-extensions/citext/package.json index 7852955ef05c..204d66a6e3dd 100644 --- a/packages/3-extensions/citext/package.json +++ b/packages/3-extensions/citext/package.json @@ -32,7 +32,7 @@ "@internal/postgres": "workspace:8.0.0-rc.23", "@internal/postgres-codec-testkit": "workspace:8.0.0-rc.23", "@internal/sql-contract-ts": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/3-extensions/paradedb/package.json b/packages/3-extensions/paradedb/package.json index 501a05b36b05..5eb58b150bbe 100644 --- a/packages/3-extensions/paradedb/package.json +++ b/packages/3-extensions/paradedb/package.json @@ -34,7 +34,7 @@ "@internal/operations": "workspace:8.0.0-rc.23", "@internal/sql-contract-psl": "workspace:8.0.0-rc.23", "@internal/target-postgres": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/3-extensions/pgvector/package.json b/packages/3-extensions/pgvector/package.json index 7fdb97d5a213..2ab3b4ab4631 100644 --- a/packages/3-extensions/pgvector/package.json +++ b/packages/3-extensions/pgvector/package.json @@ -39,7 +39,7 @@ "@internal/postgres": "workspace:8.0.0-rc.23", "@internal/postgres-codec-testkit": "workspace:8.0.0-rc.23", "@internal/sql-contract-ts": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/3-extensions/postgis/package.json b/packages/3-extensions/postgis/package.json index 04055627645c..282ee950d253 100644 --- a/packages/3-extensions/postgis/package.json +++ b/packages/3-extensions/postgis/package.json @@ -37,7 +37,7 @@ "@internal/operations": "workspace:8.0.0-rc.23", "@internal/postgres": "workspace:8.0.0-rc.23", "@internal/sql-contract-ts": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/3-extensions/supabase/package.json b/packages/3-extensions/supabase/package.json index 4eb6534b6eba..040238794310 100644 --- a/packages/3-extensions/supabase/package.json +++ b/packages/3-extensions/supabase/package.json @@ -49,7 +49,7 @@ "@internal/operations": "workspace:8.0.0-rc.23", "@internal/psl-printer": "workspace:8.0.0-rc.23", "@internal/sql-contract-psl": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/3-targets/mysql/1-mysql/9-facade/package.json b/packages/3-targets/mysql/1-mysql/9-facade/package.json index 9f4092308515..6c83094b93b6 100644 --- a/packages/3-targets/mysql/1-mysql/9-facade/package.json +++ b/packages/3-targets/mysql/1-mysql/9-facade/package.json @@ -41,7 +41,7 @@ "@internal/migration-tools": "workspace:8.0.0-rc.23", "@internal/psl-parser": "workspace:8.0.0-rc.23", "@internal/sql-schema-ir": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/packages/9-public/@prisma/orm-toolchain/package.json b/packages/9-public/@prisma/orm-toolchain/package.json index 59feb64debf1..02bdb4cb95fc 100644 --- a/packages/9-public/@prisma/orm-toolchain/package.json +++ b/packages/9-public/@prisma/orm-toolchain/package.json @@ -49,7 +49,7 @@ "typescript": "catalog:" }, "peerDependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "typescript": ">=5.9", "vite": "^7.0.0 || ^8.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad3b1b5231f2..c7090f85b882 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -198,8 +198,8 @@ importers: version: 8.21.3 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -238,8 +238,8 @@ importers: version: 2.24.0(express@5.2.1)(hono@4.11.4)(next@16.3.0(@types/node@26.1.2)(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(react-router@8.3.0(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(react@19.2.8)(vite@8.1.4(@types/node@26.1.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.0)) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/compute-sdk': specifier: ^0.43.0 version: 0.43.0(@prisma/management-api-sdk@1.76.0)(encoding@0.1.13)(rollup@4.59.0) @@ -296,8 +296,8 @@ importers: version: 8.22.0 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/dev': specifier: 'catalog:' version: 0.25.2(typescript@5.9.3)(vite@8.1.4(@types/node@26.1.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.0)) @@ -351,8 +351,8 @@ importers: version: 7.5.0(socks@2.8.9) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -397,8 +397,8 @@ importers: version: 19.2.8(react@19.2.8) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -446,8 +446,8 @@ importers: version: link:../../packages/9-public/@prisma/orm-postgres devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -486,8 +486,8 @@ importers: version: 8.22.0 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -535,8 +535,8 @@ importers: specifier: 5.20260804.1 version: 5.20260804.1 '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -590,8 +590,8 @@ importers: version: 19.2.8(react@19.2.8) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/dev': specifier: 'catalog:' version: 0.25.2(typescript@5.9.3)(vite@8.1.4(@types/node@26.1.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.0)) @@ -654,8 +654,8 @@ importers: version: link:../../packages/9-public/@prisma/orm-mariadb devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -679,8 +679,8 @@ importers: version: link:../../packages/9-public/@prisma/orm-mysql devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -710,8 +710,8 @@ importers: version: 17.4.2 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -765,8 +765,8 @@ importers: version: 5.0.0(leaflet@1.9.4)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -823,8 +823,8 @@ importers: version: 8.22.0 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/dev': specifier: 'catalog:' version: 0.25.2(typescript@5.9.3)(vite@8.1.4(@types/node@26.1.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.0)) @@ -887,8 +887,8 @@ importers: version: 8.3.0(react-dom@19.2.8(react@19.2.8))(react@19.2.8) devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/dev': specifier: 'catalog:' version: 0.25.2(typescript@5.9.3)(vite@8.1.4(@types/node@26.1.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.12)(yaml@2.9.0)) @@ -996,8 +996,8 @@ importers: version: 4.3.3 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -1048,8 +1048,8 @@ importers: version: 8.22.0 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/prisma-bin': specifier: workspace:8.0.0-rc.23 version: link:../../test/prisma-bin @@ -1526,8 +1526,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../../2-sql-family/5-runtime '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../../test/utils @@ -1645,8 +1645,8 @@ importers: version: 0.2.17 devDependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../../test/utils @@ -3240,8 +3240,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../2-sql-family/2-authoring/contract-ts '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../test/utils @@ -3341,8 +3341,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../3-targets/postgres/1-target '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../test/utils @@ -3429,8 +3429,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../2-sql-family/2-authoring/contract-ts '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../test/utils @@ -3511,8 +3511,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../2-sql-family/2-authoring/contract-ts '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../test/utils @@ -3702,8 +3702,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../2-sql-family/2-authoring/contract-psl '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../test/utils @@ -4347,8 +4347,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../../../2-sql-family/1-core/schema-ir '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../../../../../test/utils @@ -6346,8 +6346,8 @@ importers: packages/9-public/@prisma/orm-toolchain: dependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/orm-framework': specifier: workspace:8.0.0-rc.23 version: link:../orm-framework @@ -6507,8 +6507,8 @@ importers: test/e2e/framework/test/fixtures: dependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/orm-extension-arktype-json': specifier: workspace:8.0.0-rc.23 version: link:../../../../../packages/9-public/@prisma/orm-extension-arktype-json @@ -6525,8 +6525,8 @@ importers: test/e2e/framework/test/sqlite/fixtures: dependencies: '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/orm-sqlite': specifier: workspace:8.0.0-rc.23 version: link:../../../../../../packages/9-public/@prisma/orm-sqlite @@ -6724,8 +6724,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../packages/0-shared/publish-surface '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@repo/test-utils': specifier: workspace:8.0.0-rc.23 version: link:../utils @@ -6856,8 +6856,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../../../../../packages/1-framework/0-foundation/utils '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/orm-extension-pgvector': specifier: workspace:8.0.0-rc.23 version: link:../../../../../../packages/9-public/@prisma/orm-extension-pgvector @@ -6931,8 +6931,8 @@ importers: specifier: workspace:8.0.0-rc.23 version: link:../../../../../../packages/1-framework/0-foundation/utils '@prisma/cli-engine': - specifier: 0.9.0 - version: 0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) + specifier: 0.10.0 + version: 0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4) '@prisma/orm-extension-pgvector': specifier: workspace:8.0.0-rc.23 version: link:../../../../../../packages/9-public/@prisma/orm-extension-pgvector @@ -8722,8 +8722,8 @@ packages: '@prisma/adapter-pg@7.10.0': resolution: {integrity: sha512-N7nwSor0HO1Kz6xBv0TPAjAPysKK0fac6p4fVN3ensLOuzc/83Fgmln5k92eK/cvzqdkSR/2kkAqlbcdwVrwpw==} - '@prisma/cli-engine@0.9.0': - resolution: {integrity: sha512-M53Xx/KiPQ02iT8FXT2c9X+3fVgMVfWK/emf/tq+jRNFi7b0Ffwaeo1yz8XS4UKOza5DaKRwMs+K8U44z9corg==} + '@prisma/cli-engine@0.10.0': + resolution: {integrity: sha512-GdeeXQg5dmlY5aBX+coqtO8AbUwszGL/Sa9z5NcRQkUKIS7hk4EBG8mhwZFN9dKOVwahw7e9dWfpM7skl2MyGg==} engines: {node: '>=22.12.0'} peerDependencies: '@prisma/management-api-sdk': ^1.55.0 @@ -14495,7 +14495,7 @@ snapshots: transitivePeerDependencies: - pg-native - '@prisma/cli-engine@0.9.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4)': + '@prisma/cli-engine@0.10.0(@prisma/management-api-sdk@1.76.0)(magicast@0.5.4)': dependencies: '@clack/prompts': 1.5.0 '@prisma/management-api-sdk': 1.76.0 diff --git a/skills/prisma-8/references/migrations.md b/skills/prisma-8/references/migrations.md index 3fe5b116734a..e7972ceb1589 100644 --- a/skills/prisma-8/references/migrations.md +++ b/skills/prisma-8/references/migrations.md @@ -593,7 +593,7 @@ In a terminal the command asks each question in turn; type `delete`, `allow`, or 9. **Planning with no `db` ref and no `--from` in a project that already has migrations.** The origin falls through to the empty database, which would make the plan a full-create migration; `migration plan` refuses with `MIGRATION.PLAN_ORIGIN_UNKNOWN` rather than writing it. Pick the exit that matches your intent — the error lists them, and `references/migration-model.md` § *The trap* explains which to choose. 10. **Hand-authoring `migration.ts` from a blank file, or rewriting the rendered import line.** Migration files are framework-rendered — let `prisma migration plan` (or `migration new`) render the package, then edit only the holes the framework leaves for you. On Postgres leave the rendered `@internal/postgres/migration` (or `@internal/sqlite/migration`) import path alone; on Mongo leave `@prisma/orm-mongo/target/migration` as rendered. Add symbols to the existing import line rather than introducing new import paths. 12. **Replaying migrations onto a database that is already ahead.** `db migrate` on a database with no marker runs every migration, skipping operations already applied. When the database is already past a migration (it has `x int8` where the migration adds `x int4`), the run stops at that migration's precheck with `MIGRATION.PRECHECK_FAILED`. Adopt such a database with `prisma db sign` (after `contract infer` if needed), not by replaying history. -13. **Running Prisma 7 `migrate` commands against Prisma 8.** Each one answers `CLI.COMMAND_MOVED` with its Prisma 8 command: `migrate dev` is `contract emit`, `migration plan --name `, then `db migrate --advance-ref db`; `migrate deploy` is `db migrate`; `migrate reset` has no equivalent, because Prisma 8 has no reset: `db update` brings the database to the contract instead, asking before it loses data, but it keeps existing rows and runs no seed steps or data transforms (a database that changes only through migrations is moved with `db migrate`); `migrate status` is `migration status`; `migrate diff` is `db update --dry-run`, or `migration plan` to write a migration package; `migrate resolve` is `db sign `, which moves the database marker to that migration after checking its schema, but leaves `migration status` without an applied mark. While Prisma 7 still owns the migrations, run every one of them except `migrate diff`, whose replacement only reads, with Prisma 7's CLI instead. +13. **Running Prisma 7 `migrate` commands against Prisma 8.** Each one answers `CLI.V7_COMMAND` with its Prisma 8 command: `migrate dev` is `contract emit`, `migration plan --name `, then `db migrate --advance-ref db`; `migrate deploy` is `db migrate`; `migrate reset` has no equivalent, because Prisma 8 has no reset: `db update` brings the database to the contract instead, asking before it loses data, but it keeps existing rows and runs no seed steps or data transforms (a database that changes only through migrations is moved with `db migrate`); `migrate status` is `migration status`; `migrate diff` is `db update --dry-run`, or `migration plan` to write a migration package; `migrate resolve` is `db sign `, which moves the database marker to that migration after checking its schema, but leaves `migration status` without an applied mark. While Prisma 7 still owns the migrations, install Prisma 7's CLI with `npm install --save-dev @prisma/prisma7@7` and run every one of them except `migrate diff`, whose replacement only reads, as `prisma7 migrate ` instead; `migrate resolve` runs as `prisma7 migrate resolve --applied `. ## What Prisma 8 doesn't do yet diff --git a/test/e2e/framework/test/fixtures/package.json b/test/e2e/framework/test/fixtures/package.json index afbc87668e9f..f68139ce51f9 100644 --- a/test/e2e/framework/test/fixtures/package.json +++ b/test/e2e/framework/test/fixtures/package.json @@ -5,7 +5,7 @@ "version": "8.0.0-rc.23", "description": "The Postgres fixture of the e2e suite. Its own manifest because emission reads the nearest one to decide which package names generated files import, and this suite exercises two databases whose halves must not name each other's facade.", "dependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/orm-extension-arktype-json": "workspace:8.0.0-rc.23", "@prisma/orm-extension-pgvector": "workspace:8.0.0-rc.23", "@prisma/orm-postgres": "workspace:8.0.0-rc.23", diff --git a/test/e2e/framework/test/sqlite/fixtures/package.json b/test/e2e/framework/test/sqlite/fixtures/package.json index 7a4aeb0e9fa9..faf174a59839 100644 --- a/test/e2e/framework/test/sqlite/fixtures/package.json +++ b/test/e2e/framework/test/sqlite/fixtures/package.json @@ -5,7 +5,7 @@ "version": "8.0.0-rc.23", "description": "The SQLite fixture of the e2e suite. Its own manifest because emission reads the nearest one to decide which package names generated files import, and this suite exercises two databases whose halves must not name each other's facade.", "dependencies": { - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/orm-sqlite": "workspace:8.0.0-rc.23" } } diff --git a/test/integration/package.json b/test/integration/package.json index d1993a630535..bd9276f8aaa5 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -86,7 +86,7 @@ "@internal/middleware-cache": "workspace:8.0.0-rc.23", "@internal/mongo-lowering": "workspace:8.0.0-rc.23", "@internal/publish-surface": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@repo/test-utils": "workspace:8.0.0-rc.23", "@repo/tsconfig": "workspace:8.0.0-rc.23", "@repo/tsdown": "workspace:8.0.0-rc.23", diff --git a/test/integration/test/fixtures/cli/cli-e2e-test-app/package.json b/test/integration/test/fixtures/cli/cli-e2e-test-app/package.json index c427f3404025..1f70d3e649a1 100644 --- a/test/integration/test/fixtures/cli/cli-e2e-test-app/package.json +++ b/test/integration/test/fixtures/cli/cli-e2e-test-app/package.json @@ -19,7 +19,7 @@ "@internal/target-mongo": "workspace:8.0.0-rc.23", "@internal/target-postgres": "workspace:8.0.0-rc.23", "@internal/utils": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/orm-extension-pgvector": "workspace:8.0.0-rc.23", "@prisma/orm-mongo": "workspace:8.0.0-rc.23", "@prisma/orm-postgres": "workspace:8.0.0-rc.23", diff --git a/test/integration/test/fixtures/cli/cli-integration-test-app/package.json b/test/integration/test/fixtures/cli/cli-integration-test-app/package.json index 882e715566a0..4e49a0e0e8aa 100644 --- a/test/integration/test/fixtures/cli/cli-integration-test-app/package.json +++ b/test/integration/test/fixtures/cli/cli-integration-test-app/package.json @@ -20,7 +20,7 @@ "@internal/target-mongo": "workspace:8.0.0-rc.23", "@internal/target-postgres": "workspace:8.0.0-rc.23", "@internal/utils": "workspace:8.0.0-rc.23", - "@prisma/cli-engine": "0.9.0", + "@prisma/cli-engine": "0.10.0", "@prisma/orm-extension-pgvector": "workspace:8.0.0-rc.23", "@prisma/orm-mongo": "workspace:8.0.0-rc.23", "@prisma/orm-postgres": "workspace:8.0.0-rc.23", diff --git a/upgrade-instructions/pending/cli-engine-0-10/app/instructions.md b/upgrade-instructions/pending/cli-engine-0-10/app/instructions.md new file mode 100644 index 000000000000..0933c0121516 --- /dev/null +++ b/upgrade-instructions/pending/cli-engine-0-10/app/instructions.md @@ -0,0 +1,22 @@ +--- +changes: + - id: engine-pin-moves-to-0-10-0 + summary: | + The toolchain now requires `@prisma/cli-engine@0.10.0` (up from 0.9.0). A project that depends on `@prisma/cli-engine` itself must move to `0.10.0`. + detection: + glob: "**/{package.json,pnpm-workspace.yaml}" + matches: + - '"@prisma/cli-engine":\s*"[^"]*(?