The Prisma ORM: write your application in TypeScript with human-readable queries instead of SQL. Host your database on Prisma Postgres and your app on Prisma Compute.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix(v7): repair CI on every v7 pull request, and update mariadb to 3.5.4 with its IPv6 parsing change (#30668) Every pull request to `v7` currently fails CI, whatever it changes. Here is what [#30368](https://github.com/prisma/orm/pull/30368), a one-line client fix, gets today: ``` Lint pnpm audit --prod -> 7 vulnerabilities found (5 high, 2 moderate) macOS (3 jobs) brew install mysql -> compiles MySQL 26.7.0 from source -> make: *** [all] Error 2 ``` This PR makes `v7` CI pass again in three ways: 1. It updates the two vulnerable dependencies that have patched releases: `mariadb` and `source-map-js`. 2. It tells `pnpm audit` to ignore two advisories, for `braces` and `sprintf-js`. These have no patched release, and Prisma can't be attacked through them. 3. It moves the macOS jobs from the deprecated `macos-14` runner to `macos-latest`. The `mariadb` update reaches users. `@prisma/adapter-mariadb` now depends on `mariadb` 3.5.4 instead of 3.5.3, and it stops rewriting IPv6 hosts in connection strings, because 3.5.4 accepts them as written. Without that second change, the update would break IPv6 connections. ## Why CI broke without a code change `v7` last passed CI on 16 September. Nothing in the repository broke it. Two things outside the repository changed after that date. ### New security advisories fail the audit step The Lint job ends with `pnpm audit --prod`. That step fails when any production dependency has a known advisory. Since 16 September, advisories were published against four packages in our lockfile: | Package | Reached through | Advisories | What this PR does | | --- | --- | --- | --- | | `mariadb` 3.5.3 | `@prisma/adapter-mariadb`, a direct dependency | 4 (3 high) | Bumps it to 3.5.4, a patch release with the fixes | | `source-map-js` 1.2.1 | `@prisma/config` > `c12` > `magicast` | 1 (high) | Adds a pnpm override that forces at least 1.2.2 | | `braces` 3.0.3 | `@prisma/client-generator-ts` > `fast-glob` > `micromatch` | [GHSA-vfj7-8cjw-p6xm](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm) (high) | Ignores it | | `sprintf-js` 1.1.3 | `@prisma/adapter-mssql` > `mssql` > `tedious` | [GHSA-hp3w-g68c-fv3c](https://github.com/advisories/GHSA-hp3w-g68c-fv3c) (moderate) | Ignores it | The first two have fixes, so we take them. The overrides follow the same pattern as [#30314](https://github.com/prisma/orm/pull/30314), the previous audit fix on `v7`. The last two can't be fixed by upgrading. Their advisories name 3.0.4 and 1.1.4 as the patched versions, but neither version exists on npm: 3.0.3 and 1.1.3 are the latest releases. Both advisories describe a crash that happens only when an attacker controls the input string, and in Prisma no attacker can: - The generator calls `fast-glob`, which uses `braces`, only with patterns built from the user's own output folder (`generateClient.ts`). - `tedious`, the SQL Server driver, calls `sprintf` only with its own fixed message templates, for debug output and error messages. So `pnpm-workspace.yaml` now lists both advisory IDs under `auditConfig.ignoreGhsas`, with this reason written next to them. Once fixed releases exist, the ignores can go. ### Updating `mariadb` needs a change to the adapter `mariadb` 3.5.3 parsed connection strings with a regular expression that rejected the colons in a bracketed IPv6 host such as `[::1]`. So `@prisma/adapter-mariadb` rewrote that host to a percent-encoded form, which the old parser decoded back into `::1` ([#29026](https://github.com/prisma/orm/pull/29026)): ``` mariadb://user:pass@[::1]:3306/db -> mariadb://user:pass@%3A%3A1:3306/db ``` `mariadb` 3.5.4 parses connection strings with the standard `URL` parser instead, and it accepts `[::1]` as written. It no longer decodes the host, so the rewritten string made the driver look up a host literally named `%3A%3A1`. The adapter's IPv6 tests caught this. The adapter now passes the bracketed host through unchanged, and the tests check that the driver accepts it and connects to a server listening on `::1`. The release notes for 3.5.4 don't mention this parser change. Its other changes are security limits, such as the new `maxAllowedColumns` option, and bug fixes. ### Homebrew dropped macOS 14 The cross-platform test jobs run on Windows and macOS, and on macOS they install MySQL with `brew install mysql`. Homebrew no longer ships prebuilt packages for macOS 14, so that command now compiles MySQL from source, and the compile fails. GitHub has deprecated the `macos-14` runner as well. We pinned `macos-14` in [#22904](https://github.com/prisma/orm/pull/22904) in March 2024, when it was the newest runner, and nobody moved the pin after that. This PR switches those jobs, and `build-engine-branch.yml`, to `macos-latest`, which is macOS 26 on Apple Silicon today. The same jobs already use `windows-latest`, and one other macOS job in `test-template.yml` already used `macos-latest`. ## How it was checked - `pnpm audit --prod` exits 0 locally. The lockfile diff touches only `mariadb`, `source-map-js` and `iconv-lite`, which `mariadb` 3.5.4 depends on. - The `@prisma/adapter-mariadb` unit tests pass locally, including the IPv6 test that connects to a server on `::1`. - ESLint and Prettier pass on every changed file. - The macOS change can only be checked by this PR's own CI run. Agent: nestor-69 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> | 28 天前 | |
chore(deps): update dependency husky to v9 (#22805) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com> | 2 年前 | |
ci: Check for prettier formatting on GH Actions (#21188) Co-authored-by: Alexey Orlenko <alex@aqrln.net> Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com> | 3 年前 | |
docs: point the 7.x documentation at its own branch (#29827) ## Summary Companion to prisma/prisma#29826, which adds the reciprocal signpost on the default branch. **A banner at the top of the README** says which line this branch carries, and where the default branch went. Readers arrive here from links and search results as often as from the repository root, so "you are on the 7.x line" is worth saying in place. **Twelve self-links move from `/main/` to `/v7/`.** Written as `blob/main` and `tree/main`, they now resolve into the Prisma Next tree on the default branch, so the contribution guide, the code of conduct, the workflow files and the integration-test examples all lead somewhere unrelated to this code. All twelve are `github.com/prisma/prisma` self-links; links to other repositories are untouched. **The tests badge** used the legacy `workflows/CI/badge.svg` form, which reports the *default* branch's status for a workflow named `CI` — and there are no such runs there, since `test.yml` triggers on this branch. It now names `test.yml` explicitly and filters on `v7`: ```diff -[](…?query=branch%3Amain) +[](…?query=branch%3Av7) ``` **`TESTING.md` linked `release-ci.yml`**, which has not existed for some time and is now `v7-release.yml` following prisma/prisma#29823. The link text follows the workflow's current display name. ## A note on CI cost Three of the four files are root-level `*.md` and so match `test.yml`'s `paths-ignore`. `docker/docker-compose.yml` does not, and its change is a single comment line — so this documentation-only PR will run the full test matrix. Worth knowing rather than being surprised by; I kept the fix rather than leaving one stale link behind for tidiness' sake. ## Testing performed - Confirmed `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md` exist on this branch, so the repointed links resolve. - Swept all four files afterwards for surviving `/main/` self-links, `release-ci.yml` references and `branch%3Amain` queries: the only match is the banner's own deliberate link to the default branch. - Documentation is not exercised by CI; the links are the thing to spot-check on the rendered page. ## Checklist - [x] All commits are signed off per the DCO. - [x] The change is scoped to one logical concern. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net> | 3 个月前 | |
docs: agent-native initiative — spec, plan, and project workspace (#29688) ## Overview Planning-only PR: no product code changes. It adds the spec and task plan for making Prisma ORM **agent-native** — AI agents operating Prisma succeed by default: current knowledge installed where agents look, destructive actions gated behind user consent, sharp API edges documented with engine-verified semantics, and machine-friendly CLI surfaces. ## Contents **`docs/plans/agent-native/`** — detailed task drafts, following the existing `docs/plans/` convention: - `000` index: vision, verified current state, goals/non-goals, task table, execution phases, risks, future ideas - `001` skill install during `prisma init` (prisma-next precedent; deviations: non-fatal failure, pinned `skills` CLI version) - `002` one-time interactive skill offer on `prisma generate` (reuses the NPS survey gating, timeout, and persistence machinery) - `003` AI safety checkpoint: land #29684 + `prisma mcp` interplay audit - `004`–`007`, `009`–`010` skill content for [prisma/skills](https://github.com/prisma/skills): connection/URL routing, generate-after-schema-change (+ Claude Code plugin), troubleshooting suite, API pitfalls with engine-test citations, performance playbook, ORM vs platform CLI disambiguation - `008` move `typedSql` out of hidden preview (prisma-engines + schema Wasm bump) - `011` `prisma-mongodb-upgrade` skill: v6 → Prisma Next migration path (v7 ships no MongoDB connector) **`projects/agent-native/`** — the drive project workspace (spec, plan, design notes, trace journal). The plan composes four slices: init skill install → generate skill offer (stack), plus MCP safety audit and typedSql unhide (parallel). The prisma/skills content executes as a sibling project in that repo. **`AGENTS.md`** — records the NPS survey infrastructure, the `prisma mcp` command, and the `docs/plans/` convention for future agent sessions. ## Tracking - Linear project: [Agent-Native Prisma ORM](https://linear.app/prisma-company/project/agent-native-prisma-orm-da6125fbcbac) (anchor TML-2967; slices TML-2968–2971; adopted work TML-2972, TML-2973) - Related: #29684 (AI safety marker refresh, in review — gates the S3 slice) ## Notes for reviewers - Behavioral claims in the API-pitfalls task (`AND: []`/`OR: []` semantics, vacuous `every`, silently dropped `undefined` in `deleteMany`, `typedSql` hidden status) were verified against the query-engine test suite and the PSL/serializer sources; citations are in the task docs. - Open design questions (init default-on vs detection-gated, plugin placement, offer acknowledgement scope) are recorded with working positions in `projects/agent-native/spec.md` § Open Questions. | 3 个月前 | |
docs: agent-native initiative — spec, plan, and project workspace (#29688) ## Overview Planning-only PR: no product code changes. It adds the spec and task plan for making Prisma ORM **agent-native** — AI agents operating Prisma succeed by default: current knowledge installed where agents look, destructive actions gated behind user consent, sharp API edges documented with engine-verified semantics, and machine-friendly CLI surfaces. ## Contents **`docs/plans/agent-native/`** — detailed task drafts, following the existing `docs/plans/` convention: - `000` index: vision, verified current state, goals/non-goals, task table, execution phases, risks, future ideas - `001` skill install during `prisma init` (prisma-next precedent; deviations: non-fatal failure, pinned `skills` CLI version) - `002` one-time interactive skill offer on `prisma generate` (reuses the NPS survey gating, timeout, and persistence machinery) - `003` AI safety checkpoint: land #29684 + `prisma mcp` interplay audit - `004`–`007`, `009`–`010` skill content for [prisma/skills](https://github.com/prisma/skills): connection/URL routing, generate-after-schema-change (+ Claude Code plugin), troubleshooting suite, API pitfalls with engine-test citations, performance playbook, ORM vs platform CLI disambiguation - `008` move `typedSql` out of hidden preview (prisma-engines + schema Wasm bump) - `011` `prisma-mongodb-upgrade` skill: v6 → Prisma Next migration path (v7 ships no MongoDB connector) **`projects/agent-native/`** — the drive project workspace (spec, plan, design notes, trace journal). The plan composes four slices: init skill install → generate skill offer (stack), plus MCP safety audit and typedSql unhide (parallel). The prisma/skills content executes as a sibling project in that repo. **`AGENTS.md`** — records the NPS survey infrastructure, the `prisma mcp` command, and the `docs/plans/` convention for future agent sessions. ## Tracking - Linear project: [Agent-Native Prisma ORM](https://linear.app/prisma-company/project/agent-native-prisma-orm-da6125fbcbac) (anchor TML-2967; slices TML-2968–2971; adopted work TML-2972, TML-2973) - Related: #29684 (AI safety marker refresh, in review — gates the S3 slice) ## Notes for reviewers - Behavioral claims in the API-pitfalls task (`AND: []`/`OR: []` semantics, vacuous `every`, silently dropped `undefined` in `deleteMany`, `typedSql` hidden status) were verified against the query-engine test suite and the PSL/serializer sources; citations are in the task docs. - Open design questions (init default-on vs detection-gated, plugin placement, offer acknowledgement scope) are recorded with working positions in `projects/agent-native/spec.md` § Open Questions. | 3 个月前 | |
refactor: move generator out of client (#26678) ## Motivation This PR implements all of the infrastructure necessary for the new ESM-native cross-runtime TypeScript generator. ## Changes * Implement the new generator contract based on JS objects and not external processes with JSON-RPC. The old style generators are still supported and tested. * Move Prisma Client generator to a separate package bundled within the CLI. No need to search for `@prisma/client` on the disk to find the executable script anymore. We'll be able to get the full benefit of this in the new generator, as currently we still need to search for the runtime directory in the client package to copy the files over to the generated client, which we won't be doing in the modern generator. * Remove the auto-installation logic for `@prisma/client`. * Move the code shared between the client and the generator into `@prisma/client-common`. * Implement the generators registry infrastructure for the future configuration option in `prisma.config.ts`. Right now it is only prepopulated with the built-in generators but the interface is geared towards supporting the config option. * Migrate from Jest to Vitest in the files moved over to new packages, and backfill some missing tests. ## Notes Studio passes a path to the client generator executable it resolves on its own to `getGenerators` in `@prisma/internals` via `providerAliases`. To keep backward compatibility with Studio (and anything else in PDP), we still build a JSON-RPC generator bundle (now implemented as a thin wrapper around `PrismaClientJsGenerator` from `@prisma/client-generator-js`), even though it is not used in any way by the ORM itself, and have `getGenerators` accept the deprecated `providerAliases` option which it automatically converts to a `registry`. All of this can be removed once Studio is updated to make use of the new APIs. Closes: https://linear.app/prisma-company/issue/ORM-811/move-the-client-generator-out-of-the-client-package Fixes: https://github.com/prisma/prisma/issues/26560 Fixes: https://github.com/prisma/prisma/issues/25730 | 1 年前 | |
docs: Update link for Prisma examples repository (#28745) The link to the Prisma examples is incorrect since it currently 404s, but it was changed to point to the GitHub examples repo. | 10 个月前 | |
chore: update graph dependencies (#11299) | 4 年前 | |
Rename prisma7 package to @prisma/prisma7 (#30002) Renames the compatibility npm package from the unavailable unscoped `prisma7` name to `@prisma/prisma7`, while preserving `prisma7` as the executable and CLI distribution identity. ## Changes - **Package and exports:** Rename the published package and TypeScript aliases to `@prisma/prisma7`; preserve the `prisma7` bin and root/`./config` forwarding exports. - **Generated guidance:** Generate `@prisma/prisma7/config` imports and scoped install instructions for compatibility invocations, while command examples, completion, and version labels remain `prisma7`. - **Package-aware diagnostics:** Resolve and label the scoped package in mismatch, bootstrap, and install guidance without changing executable guidance. - **Packed E2E:** Install and mount the scoped `prisma-prisma7-0.0.0.tgz` artifact through the standard scoped-package path, and update fixture imports and lockfile. - **Publishing:** Remove the obsolete unscoped `prisma7` dependency exception; `@prisma/prisma7` is covered by the existing `@prisma/*` dependency graph. ## Why npm will not allow publication under the intended unscoped name. Separating package identity (`@prisma/prisma7`) from executable identity (`prisma7`) preserves the user-facing migration command while making the wrapper publishable under Prisma's scope. ## Verification - Focused Init, Bootstrap, mismatch, and path-resolution tests - `@prisma/prisma7` build, typecheck, and packed manifest inspection - Workspace utility typecheck - Packed `prisma7-compatibility` E2E - Focused Prettier, ESLint, and `git diff --check` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Prisma 7 is now distributed under the scoped `@prisma/prisma7` package name. * Initialization generates configuration files with the correct Prisma 7 package references. * CLI installation, retry, and dependency guidance now displays distribution-specific package names. * **Bug Fixes** * Updated version-mismatch warnings and generated imports to use accurate scoped package paths. * Improved Prisma 7 compatibility across configuration generation and end-to-end workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
fix(migrate): skip the migration name prompt when stdin is not a TTY (#30941) <!-- Thanks for contributing to Prisma 8! Before you submit: - Have you read CONTRIBUTING.md? - For substantive changes, did you open an issue first to discuss the direction? - Have you signed off all commits with `git commit -s`? (DCO is required.) --> ## Linked issue Fixes https://github.com/prisma/orm/issues/30940 ## Summary The `migrate dev` command prompts for a name in a non-interactive environment, causing it to hang. It happens because `getMigrationName` function checks `!isInteractive` instead of `!isInteractive()`. This value is always falsy, which means the command prompts in some non-interactive evironments. This PR fixes the issue by using the `canPrompt` function which is already used for other prompts. ## Testing performed - `packages/migrate`: `MigrateDev.test.ts`, config and SQLite blocks (27 passed). The new test `first migration (non-interactive)` times out on current `v7`, with jest never exiting, and passes with the fix. The other providers' blocks need the Docker databases and are left to CI. - `pnpm --filter @prisma/migrate build` (tsc), `eslint packages/migrate` and `prettier --check` on the changed files: clean. ## Skill update n/a - Prisma 7 branch, no change to the CLI surface. The command now does what its comment ("If not TTY or CI, use default name") already says. ## Checklist - [x] All commits are signed off (`git commit -s`) per the [DCO](../CONTRIBUTING.md#developer-certificate-of-origin-dco). The DCO status check will block merge if any commit is missing a `Signed-off-by:` trailer. - [x] I read [CONTRIBUTING.md](../CONTRIBUTING.md) and the change is scoped to one logical concern. - [x] Tests are updated (or `n/a` if the change is doc-only / refactor with no behavioural delta). - [ ] The PR title is in `TML-NNNN: <sentence-case title>` form (Linear ticket prefix + concise title naming the concrete deliverable). See `.claude/skills/create-pr/SKILL.md` for the full convention. - [x] The **Skill update** section above is filled in (or stated `n/a — internal only`). ## Also in this PR: fast-uri audit fix The Lint job's `pnpm audit --prod` step failed on four new `fast-uri` advisories (GHSA-w74x-v6f9-j3xg, GHSA-wjr9-j795-jxcr, GHSA-xhq7-xmqj-769h, GHSA-333x-w4r6-6crp). They fail every pull request to `v7`. The last commit raises the `fast-uri` override floor in `pnpm-workspace.yaml` from 3.1.6 to 3.1.9. The lockfile change is `fast-uri` 3.1.8 → 3.1.9 only. `pnpm audit --prod` now reports no known vulnerabilities. ## Notes for the reviewer The test: - Clears `CI` and `GITHUB_ACTIONS` - so that `isCi()` can't skip the prompt - Sets `TERM=dumb` - so `isInteractive()` is false even when jest runs in-band from a real terminal. Same as `DebugInfo.test.ts` does. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit ## Summary * **Bug Fixes** * Creating a first migration without a name now succeeds when interactive prompting is unavailable. The resulting migration directory has no name suffix. * Migration name prompts are not shown when interactive prompting is unavailable, including in environments where a prompt was previously supplied. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Filip Sodić <filip.sodic@fer.hr> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: willbot <w.a.madden+machine@gmail.com> | 15 小时前 | |
Teach Prisma 7 to prefer versioned config files (#30020) ## Overview Give Prisma 7 its own canonical config filename so Prisma 7 and Prisma 8 can coexist during migration. Automatic discovery now prefers `prisma7.config.*`, while existing `prisma.config.*` projects continue to work through a quiet compatibility fallback. ## Changes - Prefer the complete `prisma7.config.{js,ts,mjs,cjs,mts,cts}` family at the project root, then `.config/prisma7.*`, before invoking legacy discovery. Explicit `--config` paths remain authoritative, and relative schema, migration, Typed SQL, and view paths still resolve from the selected file. - Treat a discovered Prisma 7 config as authoritative: load or validation failures report that file and stop instead of falling through to a valid legacy config. Legacy fallback occurs only when no versioned candidate exists and adds no warning beyond the existing loaded-file diagnostic. - Reuse the supported JavaScript/TypeScript selection policy for bootstrap project detection and seed inspection, including legacy flat and `index.*` locations and ordering, while preserving `package.json` seed precedence. Do not add legacy JSON, JSONC, JSON5, YAML, YML, or TOML candidates. - Make both `prisma init` and `prisma7 init` generate `prisma7.config.ts` with their identity-appropriate config imports, and update completion, help, initialization output, and actionable CLI guidance to teach the versioned filename. - Extend the packed Prisma 7 compatibility E2E to prove precedence, hard-failure behavior, quiet fallback, and init output through both installed entrypoints: `.bin/prisma7` and the packed transitive `prisma` CLI entry. ## Why Prisma 7 and Prisma 8 cannot safely auto-discover the same filename when their config contracts may differ. A versioned namespace prevents accidental cross-version loading, while absence-only, warning-free fallback keeps existing Prisma 7 projects working unchanged. ## Scope This PR is limited to Prisma 7 config discovery, bootstrap inspection of supported JavaScript/TypeScript candidates, init output, concrete filename guidance, and compatibility coverage. It does not add bootstrap support for legacy JSON/JSONC/JSON5/YAML/YML/TOML configs, implement or parse Prisma 8 config, convert config contents, add legacy-fallback warnings, change explicit `--config` semantics, or rename other Prisma conventions. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Prisma 7 automatically discovers and prioritizes `prisma7.config.ts`. * Existing `prisma.config.ts` files remain supported as a fallback. * CLI initialization, schema discovery, seed detection, migrations, Studio, validation, and command completion now use the Prisma 7 configuration filename. * **Bug Fixes** * Improved configuration error messages and guidance for Prisma 7 projects. * **Tests** * Added coverage for configuration precedence, fallback behavior, validation, completions, initialization, and migration workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
chore(cli): bump studio, add northwind to sandbox. (#28985) Hey :wave: closes TML-1766. This PR bumps the `@prisma/studio-core` dependency, to use the improved latest version. This version introduces a tighter, correct and more informational experience in data input, amongst other smaller fixes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added ready-to-use Northwind seed databases for MySQL, PostgreSQL, and SQLite; sandbox now provisions databases by loading external seed scripts and supports Postgres runtime provisioning. * Improved sandbox provider selection and database URL handling for more reliable local provisioning. * **Chores** * Updated studio core dependency to v0.12.0. * **Dependencies** * Added a PostgreSQL client dependency to support Postgres provisioning. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> | 9 个月前 | |
chore(release): publish prisma stable releases on prev (#30124) ## Summary - publish the `prisma` package under `prev` when the release tag is `latest` - preserve all other dist-tags for `prisma` - leave publishing behavior unchanged for every other package ## Validation - `pnpm exec eslint scripts/ci/publish.ts` (0 errors; existing warnings only) - `git diff --check` - no tests run (publish script has no tests) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Corrected the npm distribution tag used when publishing the Prisma package, ensuring it uses the appropriate `prev` tag instead of `latest`. * Updated publishing logs to accurately reflect the tag applied to each package. * Other packages continue using their requested distribution tags, helping ensure releases are published and identified consistently. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
ci: enable CodeRabbit auto-reviews on the v7 branch (#29828) ## Summary Pull requests against this branch come back with: > **Review skipped** — Auto reviews are disabled on base/target branches other than the default branch. CodeRabbit reviews only the default branch unless a base branch is named in `reviews.auto_review.base_branches`, which defaults to `[]`. This branch has no `.coderabbit.yml` at all, so it adds one naming `v7`. ## Why this lands in two places prisma/prisma#29829 adds the same entry to the copy on `main`. Belt and braces, deliberately, because which copy governs the gate is genuinely unclear: - The [documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) says *"The configuration present in the **feature branch** under review will be automatically detected and used by CodeRabbit for that review."* - **This pull request falsifies that as stated.** Its own feature branch carries the file below, and CodeRabbit skipped it anyway, reporting `Configuration used: Organization UI`. The observed behaviour is equally consistent with the file being read from the **base** branch — `v7`, which has no file yet, hence the fallback to organisation settings — and with the gate being evaluated from a repository-level configuration before any branch file is consulted. CodeRabbit's `Configuration used` line does separate one thing cleanly: PRs based on `main` report `Path: .coderabbit.yml` while PRs based on `v7` report `Organization UI`, so `main`'s copy is certainly not what is consulted here today. Rather than pick a model and risk a change that merges cleanly and does nothing, the entry goes in both places. It is a handful of lines, and harmless wherever it proves redundant. If both file copies turn out to be ignored, the configuration demonstrably in force for these pull requests is **Organization UI**, and setting the base branch there is the lever that must work — an org settings change rather than anything a PR can carry. ## The profile is pinned, not defaulted `reviews.profile` is set to `assertive` explicitly. Reviews on this branch run on the organisation UI's assertive profile today, and merely introducing a repository config would otherwise take the schema default of `chill` and relax them as a silent side effect of enabling auto-review. The maintenance line keeps the stricter profile; the default branch, which sets no profile, keeps `chill`. ## Testing performed - Confirmed `reviews.auto_review.base_branches` against the published schema: *"Base branches (other than the default branch) to review. Accepts regex patterns."* - Confirmed `chill` is the schema default for `reviews.profile`, which is what made pinning it necessary rather than cosmetic. - Confirmed the file parses and resolves to the intended values. - Confirmed `projects/` exists on this branch and holds transient workspaces, as on `main`, so mirroring that path filter is meaningful rather than copied blindly. This cannot be verified before merge, and this PR being skipped is itself the evidence above. The check is the first pull request opened against this branch afterwards — both that it is reviewed at all, and that the review runs assertive. Note also that `.coderabbit.yml` is not in `test.yml`'s `paths-ignore`, so this configuration-only change runs the full test matrix. That list is duplicated across five workflow files with a comment requiring them to be kept in step, so I left it alone rather than widen this PR. ## Checklist - [x] All commits are signed off per the DCO. - [x] The change is scoped to one logical concern. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net> | 3 个月前 | |
feat(adapter-better-sqlite3): create `@prisma/adapter-better-sqlite3` (#26709) This PR: - Contributes to [ORM-731](https://linear.app/prisma-company/issue/ORM-731/new-driver-adapter-better-sqlite3-for-provider-=-sqlite) - Creates a new `@prisma/adapter-better-sqlite3` Driver Adapter - Adds `--adapter js_better_sqlite3` to the functional client test suite Next up: - use `@prisma/adapter-better-sqlite3` in `prisma-engines` --------- Co-authored-by: Florian Goessler <florian.goessler@hey.com> Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com> | 1 年前 | |
chore: update docker/git/pettier ignore files (#21567) Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com> | 2 年前 | |
chore(docker): adapt to run MongoDB v5+ in docker-compose (#22393) | 2 年前 | |
chore: remove unused query engine related logic (#28463) Remove unused query engine dependencies, QE update logic, and QE-related test logic. Ref: https://linear.app/prisma-company/issue/TML-1554/remove-query-engine-from-prisma-engines Ref: https://github.com/prisma/prisma-engines/pull/5685 | 11 个月前 | |
fix(cli): route bootstrap telemetry to Prisma Web Properties project (#29473) ## Summary - Routes bootstrap activation telemetry (`activation:*` events) to the correct PostHog project for console-related tracking. - Makes `PosthogEventCapture` accept an optional API key parameter, defaulting to the existing key for backward compatibility. - NPS feedback events remain unaffected. ## Test plan - [ ] Verify bootstrap activation events appear in the target PostHog project after running `prisma bootstrap` - [ ] Verify NPS feedback events are unaffected | 6 个月前 | |
Complete CLI-owned prisma7 distribution identity (#29969) ## Overview Complete the CLI-owned `prisma7` identity pass by making executable selection explicit at every identity-sensitive CLI boundary and by proving the shipped behavior from packed artifacts instead of slice-local mocks. The compatibility invocation now renders `prisma7` across CLI-owned help, setup, completion, and version surfaces while ordinary `prisma` callers and tests pass `'prisma'` explicitly. ## Changes - **Explicit identity plumbing**: `packages/cli/src/bin.ts` and `packages/cli/src/completions/completion-entry.ts` are the only executable-boundary inference points, and they now pass the selected identity through `CLI`, CLI-owned commands, factories, and helpers. Existing ordinary call sites such as `scripts/run-studio.ts` and the updated CLI test suites pass `'prisma'` explicitly instead of relying on fallback defaults. - **CLI-owned output stays on the selected executable**: help, init/bootstrap/postgres guidance, completion scripts, version labels, mismatch messaging, and CLI-owned rerun/install text now derive from the selected identity. `prisma7 init` emits `prisma7/config` and `prisma7` next-step commands, while stable Prisma domain surfaces such as `prisma/schema.prisma`, `prisma.config.ts`, and `@prisma/client` stay unchanged. `packages/cli/src/CLI.ts` also avoids starting the update-check path for `prisma7`. - **Cross-platform execution and build aliases**: Bootstrap resolves the selected local CLI through its Unix shim or Windows `.cmd` shim. Workspace path mappings expose exact and wildcard `prisma`/`prisma7` entrypoints, and the esbuild resolver now handles explicit files, package directories, and wildcard subpaths consistently. - **Packed proof replaces slice-local mock coverage**: the four mock-heavy identity suites and the slice-added mock assertions are gone. Evidence now comes from the single packed E2E in `packages/client/tests/e2e/prisma7-compatibility/tests/main.test.ts`, which exercises real built/packed `prisma7 --help`, `validate --help`, text/JSON `--version`, `complete zsh`, `init`, `generate`, and `db push` flows. Identity-bearing command outputs use local inline snapshots with narrow path/version normalization; completion branding uses direct assertions rather than snapshotting the generated script. ## Why Keep the identity seam mechanically auditable: executable entrypoints infer identity once, everything identity-sensitive receives it explicitly, and ordinary `prisma` callers say so explicitly. Using one packed executable-boundary proof captures the shipped wrapper behavior without over-claiming visibility into internal update or mismatch paths, while preserving stable Prisma product names that are not distribution identity. ## Scope _CLI-owned identity completion only: explicit identity plumbing across `packages/cli`, compatibility-facing help/setup/completion/version surfaces, packed executable-boundary proof, and updated ordinary-Prisma call sites/tests. Lower-package guidance, release mirroring, and publication remain out of scope._ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * CLI help, examples, errors, version output, completion commands, and generated project files now reflect the selected CLI command. * Initialization, linking, generation, migration, Studio, and database setup guidance use distribution-specific command names. * Added Prisma 7 compatibility coverage for help, version, completion, initialization, generation, and database operations. * **Bug Fixes** * Version mismatch warnings and dependency checks now reference the configured CLI. * Checkpoint checks and update messages appear only when applicable. * Existing projects use the selected local CLI for migration and generation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
revert: "chore: bump `prettier` and `eslint-plugin-prettier`" (#20182) | 3 年前 | |
fix(cli): secure Prisma Studio's local HTTP server (#29890) ## Linked issue Private vulnerability report submitted through GitHub PVR. ## Summary Prisma Studio advertised a localhost URL while its HTTP server listened on every interface and returned wildcard CORS headers. Because `POST /bff` executes database queries, a reachable network client—or a malicious website visited while Studio was open—could read or modify the connected database. This change binds the Node, Bun, and Deno servers explicitly to `127.0.0.1`, rejects browser requests whose `Origin` is not the active `localhost` or `127.0.0.1` Studio URL before routing, and removes wildcard CORS responses. Origin-less local tooling remains supported. ## Root cause The Studio rewrite introduced for Prisma 7.0.0 treated the advertised `http://localhost` URL as if it also constrained the listener. It did not specify a host and enabled permissive CORS around a privileged SQL BFF. The later pre-bundled server refactor preserved both behaviors. ## Testing performed - Dependency-aware CLI build passed across 39 workspace projects. - Targeted ESLint passed for the affected source and test files. - Studio request-handler tests passed (20/20). - Studio listener tests passed (5/5). - Full CLI Vitest passed all Studio/security coverage; one unrelated existing `Init.vitest.ts` fixture failed. - Manual built-CLI test confirmed only `127.0.0.1` was listening, the host LAN address refused connections, same-origin SQL succeeded, and hostile-origin SQL returned 403 before execution. - Headed browser smoke test loaded Studio with no console warnings or errors. ## Skill update n/a — security hardening only; no user-facing CLI command, flag, API, config field, error code, or terminology changed. ## Checklist - [x] All commits are signed off (`git commit -s`) per the DCO. - [x] I read `CONTRIBUTING.md` and the change is scoped to one logical concern. - [x] Tests are updated. - [ ] The PR title uses a Linear ticket prefix — n/a, this work comes from a private vulnerability report rather than a Linear issue. - [x] The **Skill update** section is filled in. ## Notes for the reviewer The server and BFF are implemented in the maintained `v7` branch of `prisma/prisma`; `studio-core` supplies the bundled frontend and does not own this HTTP trust boundary. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Security** * Studio servers now bind exclusively to the local loopback address. * Requests from unauthorized origins, including cross-origin preflight requests, return `403 Forbidden`. * Permissive cross-origin access and related response headers have been removed. * **Bug Fixes** * Improved protection for Studio backend and telemetry endpoints. * Standardized local server behavior across supported runtimes. * Same-origin requests continue to work correctly. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Søren Bramer Schmidt <sorenbs@gmail.com> | 3 个月前 | |
docs: architecture guide enhancement (#28955) This pull request significantly improves the repository documentation by overhauling the `ARCHITECTURE.md` file and making a minor cleanup in `CONTRIBUTING.md`. The main focus is to provide a comprehensive, contributor-friendly architectural overview, including detailed package breakdowns, repository structure, and practical guidance for generating architecture diagrams. Key documentation improvements: **Major updates to architecture documentation:** - Completely rewrote and expanded `ARCHITECTURE.md` to include a high-level overview of the repository structure, detailed descriptions of each logical layer and key packages, and clear guidance for contributors on workflows and diagram generation. - Added practical instructions for generating dependency and repository layout diagrams using GraphViz, making it easier for contributors to visualize and understand the codebase. **Minor documentation cleanup:** - Removed the outdated list of monorepo directories from `CONTRIBUTING.md` to avoid redundancy and potential confusion, as this information is now covered in the updated architecture documentation. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Major rewrite of architecture docs: expanded overview, clearer repository layout, and a categorized "Notable packages" taxonomy. * Added architecture diagrams and step-by-step graph/diagram generation, dependency, and debugging instructions. * Simplified contribution guidance by removing the redundant monorepo directory listing. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Oleksii Orlenko <alex@aqrln.net> | 3 个月前 | |
chore: add symlinks to AGENTS.md | 11 个月前 | |
Code of conduct (#2633) | 6 年前 | |
docs: point the 7.x documentation at its own branch (#29827) ## Summary Companion to prisma/prisma#29826, which adds the reciprocal signpost on the default branch. **A banner at the top of the README** says which line this branch carries, and where the default branch went. Readers arrive here from links and search results as often as from the repository root, so "you are on the 7.x line" is worth saying in place. **Twelve self-links move from `/main/` to `/v7/`.** Written as `blob/main` and `tree/main`, they now resolve into the Prisma Next tree on the default branch, so the contribution guide, the code of conduct, the workflow files and the integration-test examples all lead somewhere unrelated to this code. All twelve are `github.com/prisma/prisma` self-links; links to other repositories are untouched. **The tests badge** used the legacy `workflows/CI/badge.svg` form, which reports the *default* branch's status for a workflow named `CI` — and there are no such runs there, since `test.yml` triggers on this branch. It now names `test.yml` explicitly and filters on `v7`: ```diff -[](…?query=branch%3Amain) +[](…?query=branch%3Av7) ``` **`TESTING.md` linked `release-ci.yml`**, which has not existed for some time and is now `v7-release.yml` following prisma/prisma#29823. The link text follows the workflow's current display name. ## A note on CI cost Three of the four files are root-level `*.md` and so match `test.yml`'s `paths-ignore`. `docker/docker-compose.yml` does not, and its change is a single comment line — so this documentation-only PR will run the full test matrix. Worth knowing rather than being surprised by; I kept the fix rather than leaving one stale link behind for tidiness' sake. ## Testing performed - Confirmed `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md` exist on this branch, so the repointed links resolve. - Swept all four files afterwards for surviving `/main/` self-links, `release-ci.yml` references and `branch%3Amain` queries: the only match is the banner's own deliberate link to the default branch. - Documentation is not exercised by CI; the links are the thing to spot-check on the rendered page. ## Checklist - [x] All commits are signed off per the DCO. - [x] The change is scoped to one logical concern. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net> | 3 个月前 | |
chore: add symlinks to AGENTS.md | 11 个月前 | |
Create LICENSE | 7 年前 | |
docs: point the 7.x documentation at its own branch (#29827) ## Summary Companion to prisma/prisma#29826, which adds the reciprocal signpost on the default branch. **A banner at the top of the README** says which line this branch carries, and where the default branch went. Readers arrive here from links and search results as often as from the repository root, so "you are on the 7.x line" is worth saying in place. **Twelve self-links move from `/main/` to `/v7/`.** Written as `blob/main` and `tree/main`, they now resolve into the Prisma Next tree on the default branch, so the contribution guide, the code of conduct, the workflow files and the integration-test examples all lead somewhere unrelated to this code. All twelve are `github.com/prisma/prisma` self-links; links to other repositories are untouched. **The tests badge** used the legacy `workflows/CI/badge.svg` form, which reports the *default* branch's status for a workflow named `CI` — and there are no such runs there, since `test.yml` triggers on this branch. It now names `test.yml` explicitly and filters on `v7`: ```diff -[](…?query=branch%3Amain) +[](…?query=branch%3Av7) ``` **`TESTING.md` linked `release-ci.yml`**, which has not existed for some time and is now `v7-release.yml` following prisma/prisma#29823. The link text follows the workflow's current display name. ## A note on CI cost Three of the four files are root-level `*.md` and so match `test.yml`'s `paths-ignore`. `docker/docker-compose.yml` does not, and its change is a single comment line — so this documentation-only PR will run the full test matrix. Worth knowing rather than being surprised by; I kept the fix rather than leaving one stale link behind for tidiness' sake. ## Testing performed - Confirmed `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md` exist on this branch, so the repointed links resolve. - Swept all four files afterwards for surviving `/main/` self-links, `release-ci.yml` references and `branch%3Amain` queries: the only match is the banner's own deliberate link to the default branch. - Documentation is not exercised by CI; the links are the thing to spot-check on the rendered page. ## Checklist - [x] All commits are signed off per the DCO. - [x] The change is scoped to one logical concern. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net> | 3 个月前 | |
ci: rename the release workflow to publish.yml (#29840) > [!WARNING] > **This rename breaks publishing until the npm trusted-publisher bindings are re-pointed**, for all 47 packages this workflow publishes. Details below — it is not speculative, it happened when prisma/prisma#29823 renamed the same file. ## Summary Preparation for publishing Prisma Next's CLI as the `prisma` package under a separate dist-tag. npm binds a trusted publisher to an owner/repo plus a **workflow filename**, and a package carries one such binding. For `prisma` to be published from both this branch and the default branch, both must publish through a file of the same name — and the default branch's is `publish.yml`. So `v7-release.yml` becomes `publish.yml`. Nothing about the workflow itself changes: - **Display name stays `v7 - npm - release`**, so runs remain identifiable as belonging to this line even though the two branches now share a path. - **Triggers are untouched.** A push runs the copy on the branch pushed to, so this branch's definition and the default branch's never contend: pushes here (and to `integration/*` and `*.*.x`, which are cut from here) run this one; pushes to the default branch run that one. `test.yml` dispatches this workflow by filename for the integration-release path and follows the new name, as do the sibling comments enumerating the `paths-ignore` group and three references in `TESTING.md` — twelve references in all. ## The npm bindings must be re-pointed This branch publishes by **pure OIDC** — there is no npm token anywhere in the publish path — so every package it ships is trusted-publisher-bound to this repository plus a workflow filename. Change the filename and the token exchange stops matching. That is exactly what happened last time. prisma/prisma#29823 renamed `release.yml` to `v7-release.yml`, merging at `12:30:01Z`; the release run triggered by that merge failed 52 seconds later with: ``` [WARN] Skipped OIDC: ERR_PNPM_AUTH_TOKEN_EXCHANGE: Failed token exchange request with body message: Unknown error (status code 404) ``` pnpm's OIDC exchange 404s when npm does not recognise the repository/workflow pair. Publishing then continues unauthenticated and `pnpm publish` fails — the run died on `@prisma/client-runtime-utils`. Releases recovered at `13:25`, once the bindings named the new filename, and `7.10.0-dev.48` and `.49` have shipped since. So: merge, re-point the bindings for the 47 packages in scope, re-run the release. The window costs a delayed `dev` publish, which is why last time it passed almost unnoticed — but during a stable release it would be a good deal more disruptive, so this is not one to merge on a release day. The consolation is that this is the **last** such rename. `publish.yml` is the name the default branch already uses and the one the `prisma` binding needs permanently. ## The multi-branch reach is intended Binding `prisma` to `prisma/prisma` + `publish.yml` means any branch carrying a file at that path can publish it. That is a requirement rather than an oversight: dev and integration releases are published from pull request branches, so the trusted publisher has to reach past the two long-lived branches. Recording it here so nobody later narrows it with a GitHub environment restricted to `main` and `v7` — that would break precisely the releases it appears to protect. ## Ordering Merge this **before** prisma/prisma#29841, which removes the now-redundant `v7-release.yml` stub from the default branch. Taken in that order the release path is never unregistered: the moment this lands, `publish.yml` on the default branch occupies the path and registers it. Taken the other way round, `v7-release.yml` would briefly hold its registry entry only by virtue of recent runs — which would probably hold, but there is no reason to lean on it. ## Testing performed - Confirmed `publish.yml` does not already exist on this branch, so the rename cannot collide. - Swept the branch afterwards for surviving `v7-release.yml` references: none. - YAML parsed for all five workflow files, and the display names confirmed unchanged. - Prettier-checked all six files against this branch's `.prettierrc.yml` with the pinned 3.6.2, since the lint job checks them. - Confirmed the publish path carries no npm token, which is what makes the binding load-bearing, and read the failing run from the previous rename to establish the failure mode rather than assume it. A rename cannot be exercised before merge. Afterwards, the things to watch are the first release run reaching npm at all, then a push to this branch publishing `prisma@dev`, then the integration-release dispatch in `test.yml` resolving. ## Checklist - [x] All commits are signed off per the DCO. - [x] The change is scoped to one logical concern. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated testing guidance to reference the current publishing workflow for integration-tag package releases. * Refreshed workflow comments to keep file references consistent. * **CI** * Integration release pull requests now trigger the current publishing workflow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net> | 3 个月前 | |
Complete CLI-owned prisma7 distribution identity (#29969) ## Overview Complete the CLI-owned `prisma7` identity pass by making executable selection explicit at every identity-sensitive CLI boundary and by proving the shipped behavior from packed artifacts instead of slice-local mocks. The compatibility invocation now renders `prisma7` across CLI-owned help, setup, completion, and version surfaces while ordinary `prisma` callers and tests pass `'prisma'` explicitly. ## Changes - **Explicit identity plumbing**: `packages/cli/src/bin.ts` and `packages/cli/src/completions/completion-entry.ts` are the only executable-boundary inference points, and they now pass the selected identity through `CLI`, CLI-owned commands, factories, and helpers. Existing ordinary call sites such as `scripts/run-studio.ts` and the updated CLI test suites pass `'prisma'` explicitly instead of relying on fallback defaults. - **CLI-owned output stays on the selected executable**: help, init/bootstrap/postgres guidance, completion scripts, version labels, mismatch messaging, and CLI-owned rerun/install text now derive from the selected identity. `prisma7 init` emits `prisma7/config` and `prisma7` next-step commands, while stable Prisma domain surfaces such as `prisma/schema.prisma`, `prisma.config.ts`, and `@prisma/client` stay unchanged. `packages/cli/src/CLI.ts` also avoids starting the update-check path for `prisma7`. - **Cross-platform execution and build aliases**: Bootstrap resolves the selected local CLI through its Unix shim or Windows `.cmd` shim. Workspace path mappings expose exact and wildcard `prisma`/`prisma7` entrypoints, and the esbuild resolver now handles explicit files, package directories, and wildcard subpaths consistently. - **Packed proof replaces slice-local mock coverage**: the four mock-heavy identity suites and the slice-added mock assertions are gone. Evidence now comes from the single packed E2E in `packages/client/tests/e2e/prisma7-compatibility/tests/main.test.ts`, which exercises real built/packed `prisma7 --help`, `validate --help`, text/JSON `--version`, `complete zsh`, `init`, `generate`, and `db push` flows. Identity-bearing command outputs use local inline snapshots with narrow path/version normalization; completion branding uses direct assertions rather than snapshotting the generated script. ## Why Keep the identity seam mechanically auditable: executable entrypoints infer identity once, everything identity-sensitive receives it explicitly, and ordinary `prisma` callers say so explicitly. Using one packed executable-boundary proof captures the shipped wrapper behavior without over-claiming visibility into internal update or mismatch paths, while preserving stable Prisma product names that are not distribution identity. ## Scope _CLI-owned identity completion only: explicit identity plumbing across `packages/cli`, compatibility-facing help/setup/completion/version surfaces, packed executable-boundary proof, and updated ordinary-Prisma call sites/tests. Lower-package guidance, release mirroring, and publication remain out of scope._ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * CLI help, examples, errors, version output, completion commands, and generated project files now reflect the selected CLI command. * Initialization, linking, generation, migration, Studio, and database setup guidance use distribution-specific command names. * Added Prisma 7 compatibility coverage for help, version, completion, initialization, generation, and database operations. * **Bug Fixes** * Version mismatch warnings and dependency checks now reference the configured CLI. * Checkpoint checks and update messages appear only when applicable. * Existing projects use the selected local CLI for migration and generation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
chore(deps-dev): bump globals from 16.0.0 to 17.7.0 (#29765) Bumps [globals](https://github.com/sindresorhus/globals) from 16.0.0 to 17.7.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/sindresorhus/globals/releases">globals's releases</a>.</em></p> <blockquote> <h2>v17.7.0</h2> <ul> <li>Update globals (2026-06-22) (<a href="https://redirect.github.com/sindresorhus/globals/issues/345">#345</a>) 33b75f9</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.6.0...v17.7.0">https://github.com/sindresorhus/globals/compare/v17.6.0...v17.7.0</a></p> <h2>v17.6.0</h2> <ul> <li>Update globals (2026-05-01) (<a href="https://redirect.github.com/sindresorhus/globals/issues/343">#343</a>) 00a4dd9</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.5.0...v17.6.0">https://github.com/sindresorhus/globals/compare/v17.5.0...v17.6.0</a></p> <h2>v17.5.0</h2> <ul> <li>Update globals (2026-04-12) (<a href="https://redirect.github.com/sindresorhus/globals/issues/342">#342</a>) 5d84602</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.4.0...v17.5.0">https://github.com/sindresorhus/globals/compare/v17.4.0...v17.5.0</a></p> <h2>v17.4.0</h2> <ul> <li>Update globals (2026-03-01) (<a href="https://redirect.github.com/sindresorhus/globals/issues/338">#338</a>) d43a051</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.3.0...v17.4.0">https://github.com/sindresorhus/globals/compare/v17.3.0...v17.4.0</a></p> <h2>v17.3.0</h2> <ul> <li>Update globals (2026-02-01) (<a href="https://redirect.github.com/sindresorhus/globals/issues/336">#336</a>) 295fba9</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.2.0...v17.3.0">https://github.com/sindresorhus/globals/compare/v17.2.0...v17.3.0</a></p> <h2>v17.2.0</h2> <ul> <li><code>jasmine</code>: Add <code>throwUnless</code> and <code>throwUnlessAsync</code> globals (<a href="https://redirect.github.com/sindresorhus/globals/issues/335">#335</a>) 97f23a7</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.1.0...v17.2.0">https://github.com/sindresorhus/globals/compare/v17.1.0...v17.2.0</a></p> <h2>v17.1.0</h2> <ul> <li>Add <code>webpack</code> and <code>rspack</code> globals (<a href="https://redirect.github.com/sindresorhus/globals/issues/333">#333</a>) 65cae73</li> </ul> <hr /> <p><a href="https://github.com/sindresorhus/globals/compare/v17.0.0...v17.1.0">https://github.com/sindresorhus/globals/compare/v17.0.0...v17.1.0</a></p> <h2>v17.0.0</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/sindresorhus/globals/commit/a19670cc86c1218e915657c55ea02ba3e7623834"><code>a19670c</code></a> 17.7.0</li> <li><a href="https://github.com/sindresorhus/globals/commit/9611620bad0ea45531ae0261b986ce694374e42c"><code>9611620</code></a> Update actions (<a href="https://redirect.github.com/sindresorhus/globals/issues/346">#346</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/33b75f9ddeb6f9ddd81251b043667eb8104a8d15"><code>33b75f9</code></a> Update globals (2026-06-22) (<a href="https://redirect.github.com/sindresorhus/globals/issues/345">#345</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/887dd529bde24486b7f9e31d1b2c515df2b7cf5c"><code>887dd52</code></a> Fix build script (<a href="https://redirect.github.com/sindresorhus/globals/issues/344">#344</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/6b15870f1c08b60b5b57afe45a703d9ed0be39bc"><code>6b15870</code></a> 17.6.0</li> <li><a href="https://github.com/sindresorhus/globals/commit/00a4dd9821830a9b044798120e86b1bb1a54648d"><code>00a4dd9</code></a> Update globals (2026-05-01) (<a href="https://redirect.github.com/sindresorhus/globals/issues/343">#343</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/b8170c8e1d648291b613c5b39a69652c796fa36c"><code>b8170c8</code></a> 17.5.0</li> <li><a href="https://github.com/sindresorhus/globals/commit/5d846029679832931f38ced6381cc95bcb9abd80"><code>5d84602</code></a> Update globals (2026-04-12) (<a href="https://redirect.github.com/sindresorhus/globals/issues/342">#342</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/1b727e5f4cc39121b8e77b9f27574a8ca27391fc"><code>1b727e5</code></a> Fix build script for ES globals (<a href="https://redirect.github.com/sindresorhus/globals/issues/341">#341</a>)</li> <li><a href="https://github.com/sindresorhus/globals/commit/a9cfd7493fb701474d4dc946283c7b9d63d64134"><code>a9cfd74</code></a> 17.4.0</li> <li>Additional commits viewable in <a href="https://github.com/sindresorhus/globals/compare/v16.0.0...v17.7.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 3 个月前 | |
fix(migrate): skip the migration name prompt when stdin is not a TTY (#30941) <!-- Thanks for contributing to Prisma 8! Before you submit: - Have you read CONTRIBUTING.md? - For substantive changes, did you open an issue first to discuss the direction? - Have you signed off all commits with `git commit -s`? (DCO is required.) --> ## Linked issue Fixes https://github.com/prisma/orm/issues/30940 ## Summary The `migrate dev` command prompts for a name in a non-interactive environment, causing it to hang. It happens because `getMigrationName` function checks `!isInteractive` instead of `!isInteractive()`. This value is always falsy, which means the command prompts in some non-interactive evironments. This PR fixes the issue by using the `canPrompt` function which is already used for other prompts. ## Testing performed - `packages/migrate`: `MigrateDev.test.ts`, config and SQLite blocks (27 passed). The new test `first migration (non-interactive)` times out on current `v7`, with jest never exiting, and passes with the fix. The other providers' blocks need the Docker databases and are left to CI. - `pnpm --filter @prisma/migrate build` (tsc), `eslint packages/migrate` and `prettier --check` on the changed files: clean. ## Skill update n/a - Prisma 7 branch, no change to the CLI surface. The command now does what its comment ("If not TTY or CI, use default name") already says. ## Checklist - [x] All commits are signed off (`git commit -s`) per the [DCO](../CONTRIBUTING.md#developer-certificate-of-origin-dco). The DCO status check will block merge if any commit is missing a `Signed-off-by:` trailer. - [x] I read [CONTRIBUTING.md](../CONTRIBUTING.md) and the change is scoped to one logical concern. - [x] Tests are updated (or `n/a` if the change is doc-only / refactor with no behavioural delta). - [ ] The PR title is in `TML-NNNN: <sentence-case title>` form (Linear ticket prefix + concise title naming the concrete deliverable). See `.claude/skills/create-pr/SKILL.md` for the full convention. - [x] The **Skill update** section above is filled in (or stated `n/a — internal only`). ## Also in this PR: fast-uri audit fix The Lint job's `pnpm audit --prod` step failed on four new `fast-uri` advisories (GHSA-w74x-v6f9-j3xg, GHSA-wjr9-j795-jxcr, GHSA-xhq7-xmqj-769h, GHSA-333x-w4r6-6crp). They fail every pull request to `v7`. The last commit raises the `fast-uri` override floor in `pnpm-workspace.yaml` from 3.1.6 to 3.1.9. The lockfile change is `fast-uri` 3.1.8 → 3.1.9 only. `pnpm audit --prod` now reports no known vulnerabilities. ## Notes for the reviewer The test: - Clears `CI` and `GITHUB_ACTIONS` - so that `isCi()` can't skip the prompt - Sets `TERM=dumb` - so `isInteractive()` is false even when jest runs in-band from a real terminal. Same as `DebugInfo.test.ts` does. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit ## Summary * **Bug Fixes** * Creating a first migration without a name now succeeds when interactive prompting is unavailable. The resulting migration directory has no name suffix. * Migration name prompts are not shown when interactive prompting is unavailable, including in environments where a prompt was previously supplied. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Filip Sodić <filip.sodic@fer.hr> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: willbot <w.a.madden+machine@gmail.com> | 15 小时前 | |
fix(migrate): skip the migration name prompt when stdin is not a TTY (#30941) <!-- Thanks for contributing to Prisma 8! Before you submit: - Have you read CONTRIBUTING.md? - For substantive changes, did you open an issue first to discuss the direction? - Have you signed off all commits with `git commit -s`? (DCO is required.) --> ## Linked issue Fixes https://github.com/prisma/orm/issues/30940 ## Summary The `migrate dev` command prompts for a name in a non-interactive environment, causing it to hang. It happens because `getMigrationName` function checks `!isInteractive` instead of `!isInteractive()`. This value is always falsy, which means the command prompts in some non-interactive evironments. This PR fixes the issue by using the `canPrompt` function which is already used for other prompts. ## Testing performed - `packages/migrate`: `MigrateDev.test.ts`, config and SQLite blocks (27 passed). The new test `first migration (non-interactive)` times out on current `v7`, with jest never exiting, and passes with the fix. The other providers' blocks need the Docker databases and are left to CI. - `pnpm --filter @prisma/migrate build` (tsc), `eslint packages/migrate` and `prettier --check` on the changed files: clean. ## Skill update n/a - Prisma 7 branch, no change to the CLI surface. The command now does what its comment ("If not TTY or CI, use default name") already says. ## Checklist - [x] All commits are signed off (`git commit -s`) per the [DCO](../CONTRIBUTING.md#developer-certificate-of-origin-dco). The DCO status check will block merge if any commit is missing a `Signed-off-by:` trailer. - [x] I read [CONTRIBUTING.md](../CONTRIBUTING.md) and the change is scoped to one logical concern. - [x] Tests are updated (or `n/a` if the change is doc-only / refactor with no behavioural delta). - [ ] The PR title is in `TML-NNNN: <sentence-case title>` form (Linear ticket prefix + concise title naming the concrete deliverable). See `.claude/skills/create-pr/SKILL.md` for the full convention. - [x] The **Skill update** section above is filled in (or stated `n/a — internal only`). ## Also in this PR: fast-uri audit fix The Lint job's `pnpm audit --prod` step failed on four new `fast-uri` advisories (GHSA-w74x-v6f9-j3xg, GHSA-wjr9-j795-jxcr, GHSA-xhq7-xmqj-769h, GHSA-333x-w4r6-6crp). They fail every pull request to `v7`. The last commit raises the `fast-uri` override floor in `pnpm-workspace.yaml` from 3.1.6 to 3.1.9. The lockfile change is `fast-uri` 3.1.8 → 3.1.9 only. `pnpm audit --prod` now reports no known vulnerabilities. ## Notes for the reviewer The test: - Clears `CI` and `GITHUB_ACTIONS` - so that `isCi()` can't skip the prompt - Sets `TERM=dumb` - so `isInteractive()` is false even when jest runs in-band from a real terminal. Same as `DebugInfo.test.ts` does. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit ## Summary * **Bug Fixes** * Creating a first migration without a name now succeeds when interactive prompting is unavailable. The resulting migration directory has no name suffix. * Migration name prompts are not shown when interactive prompting is unavailable, including in environments where a prompt was previously supplied. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Filip Sodić <filip.sodic@fer.hr> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: willbot <w.a.madden+machine@gmail.com> | 15 小时前 | |
Rename prisma7 package to @prisma/prisma7 (#30002) Renames the compatibility npm package from the unavailable unscoped `prisma7` name to `@prisma/prisma7`, while preserving `prisma7` as the executable and CLI distribution identity. ## Changes - **Package and exports:** Rename the published package and TypeScript aliases to `@prisma/prisma7`; preserve the `prisma7` bin and root/`./config` forwarding exports. - **Generated guidance:** Generate `@prisma/prisma7/config` imports and scoped install instructions for compatibility invocations, while command examples, completion, and version labels remain `prisma7`. - **Package-aware diagnostics:** Resolve and label the scoped package in mismatch, bootstrap, and install guidance without changing executable guidance. - **Packed E2E:** Install and mount the scoped `prisma-prisma7-0.0.0.tgz` artifact through the standard scoped-package path, and update fixture imports and lockfile. - **Publishing:** Remove the obsolete unscoped `prisma7` dependency exception; `@prisma/prisma7` is covered by the existing `@prisma/*` dependency graph. ## Why npm will not allow publication under the intended unscoped name. Separating package identity (`@prisma/prisma7`) from executable identity (`prisma7`) preserves the user-facing migration command while making the wrapper publishable under Prisma's scope. ## Verification - Focused Init, Bootstrap, mismatch, and path-resolution tests - `@prisma/prisma7` build, typecheck, and packed manifest inspection - Workspace utility typecheck - Packed `prisma7-compatibility` E2E - Focused Prettier, ESLint, and `git diff --check` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Prisma 7 is now distributed under the scoped `@prisma/prisma7` package name. * Initialization generates configuration files with the correct Prisma 7 package references. * CLI installation, retry, and dependency guidance now displays distribution-specific package names. * **Bug Fixes** * Updated version-mismatch warnings and generated imports to use accurate scoped package paths. * Improved Prisma 7 compatibility across configuration generation and end-to-end workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Steven McClankerton <tatarintsev@prisma.io> | 2 个月前 | |
feat(migrate): introduce `@prisma/schema-engine-wasm` and `SchemaEngineWasm` (#26782) This PR: - closes [ORM-700](https://linear.app/prisma-company/issue/ORM-700/create-schemaenginewasm-class-that-replaces-the-schemaengine-json-rpc) and [ORM-699](https://linear.app/prisma-company/issue/ORM-699/opt-in-for-schema-engine-wasm-when-its-provided-in-prisma-config) - installs `@prisma/schema-engine-wasm` into Prisma, sets it up in `packages/internals/src/wasm.ts`, and hooks it into a new `SchemaEngineWasm` class - renames `SchemaEngine` into `SchemaEngineCLI` - forces `SchemaEngineWasm` and `SchemaEngineCLI` to adhere to the same interface, `SchemaEngine` - updates `Migrate` so that it conditionally creates a `SchemaEngineWasm` whenever an `adapter` is provided; this is done in an async `setup` function - updates tests and commands that were using `new SchemaEngine` and `new Migrate` - deprecates https://github.com/prisma/prisma/pull/26753 and https://github.com/prisma/prisma/pull/26760 --------- Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com> | 1 年前 | |
chore(reproductions): rename dir to sandbox & ignore for CI / Renovate (#21914) Co-authored-by: pierre <pierreantoine.urvoy@gmail.com> | 2 年前 | |
ci: type check codebase (#20855) | 3 年前 | |
fix(turbo): rebuild packages when build scripts change (#28741) Rebuild potentially affected packages when build scripts or other code in `/helpers` change. | 11 个月前 | |
chore: bump vitest to 4.0 (#29227) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Upgraded development test tooling to v4.0.18 in several test packages. * Removed the test framework declaration from multiple package dev configs to consolidate dev tooling. * Added per-package test configurations to exclude build artifacts (dist) from test runs. * Adjusted internal test mocks; no changes to runtime behavior or public APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: jacek-prisma <malec@prisma.io> | 8 个月前 |

This is the Prisma ORM 7.x line, maintained on the
v7branch. The default branch of this repository now hosts Prisma Next, a TypeScript rewrite of Prisma ORM. Theprismaand@prisma/*packages on npm are published from here.
What is Prisma?
Prisma ORM is a next-generation ORM that consists of these tools:
- Prisma Client: Auto-generated and type-safe query builder for Node.js & TypeScript
- Prisma Migrate: Declarative data modeling & migration system
- Prisma Studio: GUI to view and edit data in your database
Prisma Client can be used in any Node.js or TypeScript backend application (including serverless applications and microservices). This can be a REST API, a GraphQL API, a gRPC API, or anything else that needs a database.
If you need a database to use with Prisma ORM, check out Prisma Postgres or if you are looking for our MCP Server, head here.
Getting started
Quickstart (5min)
The fastest way to get started with Prisma is by following the quickstart guides. You can choose either of two databases:
Bring your own database
If you already have your own database, you can follow these guides:
How Prisma ORM works
This section provides a high-level overview of how Prisma ORM works and its most important technical components. For a more thorough introduction, visit the Prisma documentation.
The Prisma schema
Every project that uses a tool from the Prisma toolkit starts with a Prisma schema file. The Prisma schema allows developers to define their application models in an intuitive data modeling language and configure generators.
// Data source
datasource db {
provider = "postgresql"
}
// Generator
generator client {
provider = "prisma-client"
output = "../generated"
}
// Data model
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
In this schema, you configure three things:
- Data source: Specifies your database type and thus defines the features and data types you can use in the schema
- Generator: Indicates that you want to generate Prisma Client
- Data model: Defines your application models
prisma.config.ts
Database connection details are defined via prisma.config.ts.
import { defineConfig } from 'prisma/config'
export default defineConfig({
datasource: {
url: 'postgres://...',
},
})
If you store the database connection string in process.env, an env function can help you access it in a type safe way and throw an error if it is missing at run time:
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
datasource: {
url: env('DATABASE_URL'),
},
})
Prisma ORM does not load the .env files for you automatically. If you want to populate the environment variables from a .env file, consider using a package such as dotenv or @dotenvx/dotenvx.
The configuration file may look like this in that case:
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
datasource: {
url: env('DATABASE_URL'),
},
})
To start a local PostgreSQL development server without using Docker and without any configuration, run prisma dev:
npx prisma dev
Alternatively, spin up an instant Prisma Postgres® database in the cloud:
npx create-db --interactive
The Prisma data model
On this page, the focus is on the data model. You can learn more about Data sources and Generators on the respective docs pages.
Functions of Prisma models
The data model is a collection of models. A model has two major functions:
- Represent a table in the underlying database
- Provide the foundation for the queries in the Prisma Client API
Getting a data model
There are two major workflows for "getting" a data model into your Prisma schema:
- Generate the data model from introspecting a database
- Manually writing the data model and mapping it to the database with Prisma Migrate
Once the data model is defined, you can generate Prisma Client which will expose CRUD and more queries for the defined models. If you're using TypeScript, you'll get full type-safety for all queries (even when only retrieving the subsets of a model's fields).
Accessing your database with Prisma Client
Step 1: Install Prisma
First, install Prisma CLI as a development dependency and Prisma Client:
npm install prisma --save-dev
npm install @prisma/client
Step 2: Set up your Prisma schema
Ensure your Prisma schema includes a generator block with an output path specified:
generator client {
provider = "prisma-client"
output = "../generated"
}
datasource db {
provider = "postgresql" // mysql (incl. mariadb), sqlite, sqlserver, mongodb or cockroachdb
}
Step 3: Configure Prisma Config
Configure the Prisma CLI using a prisma.config.ts file. This file configures Prisma CLI subcommands like migrate and studio. Create a prisma.config.ts file in your project root:
import { defineConfig, env } from 'prisma/config'
type Env = {
DATABASE_URL: string
}
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env<Env>('DATABASE_URL'),
},
})
Note: Environment variables from .env files are not automatically loaded when using prisma.config.ts. You can use dotenv by importing dotenv/config at the top of your config file. For Bun, .env files are automatically loaded.
Learn more about Prisma Config and all available configuration options.
Step 4: Generate Prisma Client
Generate Prisma Client with the following command:
npx prisma generate
This command reads your Prisma schema and generates the Prisma Client code in the location specified by the output path in your generator configuration.
After you change your data model, you'll need to manually re-generate Prisma Client to ensure the generated code gets updated:
npx prisma generate
Refer to the documentation for more information about "generating the Prisma client".
Step 5: Use Prisma Client to send queries to your database
Once the Prisma Client is generated, you can import it in your code and send queries to your database.
Import and instantiate Prisma Client
You can import and instantiate Prisma Client from the output path specified in your generator configuration. When instantiating the Client, you need to provide a driver adapter to its constructor. For example, when using PostgreSQL with a driver adapter:
import { PrismaClient } from './generated/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
To load environment variables, you can use dotenv by importing dotenv/config, use tsx --env-file=.env, node --env-file=.env, or Bun (which loads .env automatically).
Now you can start sending queries via the generated Prisma Client API, here are a few sample queries. Note that all Prisma Client queries return plain old JavaScript objects.
Learn more about the available operations in the Prisma Client docs or watch this demo video (2 min).
Retrieve all User records from the database
const allUsers = await prisma.user.findMany()
Include the posts relation on each returned User object
const allUsers = await prisma.user.findMany({
include: { posts: true },
})
Filter all Post records that contain "prisma"
const filteredPosts = await prisma.post.findMany({
where: {
OR: [{ title: { contains: 'prisma' } }, { content: { contains: 'prisma' } }],
},
})
Create a new User and a new Post record in the same query
const user = await prisma.user.create({
data: {
name: 'Alice',
email: 'alice@prisma.io',
posts: {
create: { title: 'Join us for Prisma Day 2021' },
},
},
})
Update an existing Post record
const post = await prisma.post.update({
where: { id: 42 },
data: { published: true },
})
Usage with TypeScript
Note that when using TypeScript, the result of this query will be statically typed so that you can't accidentally access a property that doesn't exist (and any typos are caught at compile-time). Learn more about leveraging Prisma Client's generated types on the Advanced usage of generated types page in the docs.
Community
Prisma has a large and supportive community of enthusiastic application developers. You can join us on Discord and here on GitHub.
Badges
Built something awesome with Prisma? 🌟 Show it off with these badges, perfect for your readme or website.
[](https://prisma.io)
[](https://prisma.io)
Security
If you have a security issue to report, please contact us at security@prisma.io.
Support
Ask a question about Prisma
You can ask questions and initiate discussions about Prisma-related topics in the prisma repository on GitHub.
Create a bug report for Prisma
If you see an error message or run into an issue, please make sure to create a bug report! You can find best practices for creating bug reports (like including additional debugging output) in the docs.
Submit a feature request
If Prisma currently doesn't have a certain feature, be sure to check out the roadmap to see if this is already planned for the future.
If the feature on the roadmap is linked to a GitHub issue, please make sure to leave a 👍 reaction on the issue and ideally a comment with your thoughts about the feature!
Contributing
Refer to our contribution guidelines and Code of Conduct for contributors.
Tests Status
Scheduled CI is currently disabled across the ORM repos; test workflows run on push, pull request, and manual workflow_dispatch. See the Actions tab for recent runs.
项目介绍
下一代ORM,适用于Node.js和TypeScript | 支持PostgreSQL、MySQL、MariaDB、SQL Server、SQLite、MongoDB及CockroachDB【此简介由AI生成】