Repository navigation
feat(postgres): wire ORM to transactions - #347
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a transaction-scoped ORM client to Postgres transactions: Changes
Sequence DiagramsequenceDiagram
participant Test
participant Client as Postgres Client
participant TxCtx as Transaction Context
participant TxOrm as Transaction ORM
participant Runtime
Test->>Client: db.transaction(fn)
Client->>TxCtx: create txSql and txCtx
Client->>TxOrm: construct tx-scoped ORM (delegates execute)
Client->>Test: invoke fn(tx { sql, orm })
Test->>TxOrm: orm.create / orm.query
TxOrm->>Runtime: runtime.execute(plan) via txCtx
Runtime->>TxCtx: execute(plan) within transaction
Runtime-->>TxOrm: result
TxOrm-->>Test: return result
alt commit
Test->>TxCtx: commit
TxCtx->>Runtime: commit
else rollback
Test->>TxCtx: throw -> rollback
TxCtx->>Runtime: rollback
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/middleware-telemetry
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/runtime-executor
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
13fd20e to
c15f5d9
Compare
## PR Stack: Transaction API | PR | Description | Base | |---|---|---| | **#345** (this) | 📄 Spec, plan, and ADR | `main` | | #346 | ⚙️ Core transaction runtime + `db.transaction()` + `tx.sql` | `#345` | | #347 | 🔗 Wire `tx.orm` into transactions | `#346` | Part of https://linear.app/prisma-company/issue/TML-1912/orm-transaction-support --- ## Summary Adds the foundational design documents for the **ORM Client Transaction API** (`db.transaction(callback)`): - **Spec** — full feature specification for `db.transaction()` on `PostgresClient` - **Plan** — 4-milestone delivery plan with acceptance criteria traceability matrix - **ADR 187** — architecture decision on how transaction-scoped streams handle post-commit consumption ## Spec highlights The API follows a **callback-scoped** pattern — no dangling transactions, guaranteed cleanup: ```ts await db.transaction(async (tx) => { await tx.orm.account.where({ id: fromId }).update({ balance: fromBalance - amount }); const plan = tx.sql.from(tables.auditLog).insert({ action: 'transfer', amount }).build(); await tx.execute(plan); }); ``` The transaction context exposes three surfaces: - `tx.orm` — full ORM collection API bound to the transaction connection - `tx.sql` — typed SQL builder (`Db<TContract>`) bound to the same connection - `tx.execute(plan)` — execute a built plan directly Explicit **non-goals**: configurable isolation levels, savepoints/nesting, automatic retry, interactive begin/commit/rollback handle, timeout, MongoDB support. ## Plan | Milestone | Scope | Status | |---|---|---| | M1 — Transaction runtime plumbing | `withTransaction` helper, `db.transaction()`, `tx.sql`, unit + e2e tests | ✅ Done | | M2 — ORM integration | `tx.orm` wiring, `withMutationScope` fallback, nested-mutation e2e tests | ✅ Done | | M3 — Type safety & edge cases | Type-level tests, `PromiseLike` drain, post-commit invalidation, lazy connect | ☐ Pending | | M4 — Close-out | Acceptance criteria verification, doc finalization, project cleanup | ☐ Pending | ## ADR 187: Transaction-scoped streams use invalidation, not buffering **Decision**: When a transaction ends, the scoped `RuntimeQueryable` sets an `invalidated` flag. Any `AsyncIterableResult` consumed after that point throws a clear error rather than hitting a released connection. **Rejected alternatives**: eager buffering (silently changes semantics), type-level prevention (breaks inference), pre-commit tracking (rejects valid patterns), do nothing (confusing errors). The ADR includes a wire-protocol safety analysis confirming that unconsumed result streams cannot hide database errors or cause an incorrect COMMIT in Postgres. ## Files - `projects/orm-client-transaction-api/spec.md` (new) - `projects/orm-client-transaction-api/plan.md` (new) - `docs/architecture docs/adrs/ADR 187 - Transaction-scoped streams use invalidation not buffering.md` (new) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added guidance on transaction-scoped streaming behavior, including error handling for results accessed outside the transaction scope and best practices for consuming results within transactions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
f4da1a0 to
f189362
Compare
c15f5d9 to
0f137e3
Compare
f189362 to
de5e736
Compare
d5d3218 to
8827064
Compare
8827064 to
e59ef85
Compare
ca6cb9e to
bbe5b7f
Compare
## PR Stack: Transaction API | PR | Description | Base | |---|---|---| | #345 | 📄 Spec, plan, and ADR | `main` | | **#346** (this) | ⚙️ Core transaction runtime + `db.transaction()` + `tx.sql` | `#345` | | #347 | 🔗 Wire `tx.orm` into transactions | `#346` | Refs: https://linear.app/prisma-company/issue/TML-1912/orm-transaction-support Closes: https://linear.app/prisma-company/issue/TML-2161/orm-sql-dsl-transaction-interop --- ## Summary Implements **Milestone 1** of the transaction API: the core `withTransaction` helper in `sql-runtime` (target-agnostic) and the `db.transaction()` surface on `PostgresClient` with `tx.sql` support. ## Implementation ### `withTransaction(runtime, fn)` — `@prisma-next/sql-runtime` A target-agnostic helper that manages the full transaction lifecycle: 1. Acquires a connection from the pool → starts a transaction 2. Runs the user callback with a guarded `TransactionContext` 3. On success: sets `invalidated = true` → commits → releases connection 4. On error: sets `invalidated = true` → rolls back → releases connection → re-throws Safety features: - **Pre-execution guard** — calling `tx.execute()` after the transaction ends throws `RUNTIME.TRANSACTION_CLOSED` - **Iteration guard** — a guarded `AsyncGenerator` wraps every result; consuming rows post-commit throws the same error per-yield - **Rollback failure wrapping** — if rollback itself fails, produces `RUNTIME.TRANSACTION_ROLLBACK_FAILED` with the original error as `.cause` ### `PostgresClient.transaction()` + `PostgresTransactionContext` ```ts export interface PostgresTransactionContext<TContract extends Contract<SqlStorage>> extends TransactionContext { readonly sql: Db<TContract>; } ``` `db.transaction(fn)` delegates to `withTransaction`, attaching a fresh `Db<TContract>` SQL builder as `tx.sql`. Lazy-initializes the runtime on first call (same as `connect()` / `runtime()`). ### New public exports from `@prisma-next/sql-runtime` - `TransactionContext` (type) - `RuntimeConnection`, `RuntimeTransaction`, `RuntimeQueryable` (types — previously internal) - `withTransaction` (function) ## Tests ### Unit tests — `withTransaction` (12 tests) | Test | Covers | |---|---| | commits on successful callback and returns the result | Happy path | | rolls back on callback error and re-throws | Error path | | releases connection after commit | Cleanup on success | | releases connection after rollback | Cleanup on failure | | propagates commit failure | COMMIT throws | | forwards the callback return value | Complex return type | | executes queries against the transaction | Routing to transaction scope | | throws on execute after commit (invalidation) | Post-commit guard | | throws on iteration of escaped AsyncIterableResult after commit | Iteration guard | | sets invalidated flag after commit | Flag transition | | wraps original error when rollback fails | Double-fault handling | | sets invalidated flag after rollback | Flag on error path | | releases connection independently across sequential transactions | 3 sequential txns | ### Unit tests — Postgres (3 tests) - `transaction()` delegates to `withTransaction` with the lazy runtime - `transaction()` provides `sql` on the transaction context - `transaction()` lazily creates runtime before `connect()` ### Type-level tests (3 tests) - Transaction context does not expose a `transaction` method (no nesting) - `db.transaction()` infers callback return type correctly - `tx.sql` has the same type as `db.sql` ### E2E tests against real Postgres (5 tests) - Commits both writes atomically (two INSERTs visible after commit) - Rolls back all writes on error (0 rows after throw) - Forwards callback return value after commit - Collects returned stream before commit (`PromiseLike` auto-drain) - Rejects escaped `AsyncIterableResult` consumed after commit ## Key design decisions - **Callback-scoped (RAII-style)** — guaranteed cleanup, no dangling transactions - **Invalidation over buffering** — consistent lazy `execute()` semantics everywhere (ADR 187) - **Structured error codes** — `RUNTIME.TRANSACTION_CLOSED`, `RUNTIME.TRANSACTION_ROLLBACK_FAILED` - **Layered composition** — core helper in `sql-runtime`, adapter adds `tx.sql` surface - **No nested transactions by type design** — `PostgresTransactionContext` omits `transaction`, enforced at compile time - **`PromiseLike<R>` callback return** — auto-drains `AsyncIterableResult` when returned directly ## Files changed - `packages/2-sql/5-runtime/src/sql-runtime.ts` — `withTransaction`, `TransactionContext` - `packages/2-sql/5-runtime/src/exports/index.ts` — new exports - `packages/2-sql/5-runtime/test/sql-runtime.test.ts` — 12 unit tests - `packages/3-extensions/postgres/src/runtime/postgres.ts` — `db.transaction()`, `PostgresTransactionContext` - `packages/3-extensions/postgres/test/postgres.test.ts` — 3 unit tests - `packages/3-extensions/postgres/test/transaction.types.test-d.ts` — 3 type tests (new) - `test/e2e/framework/test/transaction.test.ts` — 5 e2e tests (new) - `projects/orm-client-transaction-api/{plan,spec}.md` — mark M1 tasks done <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added high-level transaction helper for managed callbacks and atomic multi-operation workflows. * Transactions expose an invalidated flag to prevent use of results after completion. * Postgres client gains a transaction method providing a transaction-scoped DB context. * Connection lifecycle: added destroy() for safer teardown and improved driver/connection cleanup semantics. * **Tests** * Added unit, type-level, and E2E tests covering commit/rollback, error wrapping, invalidation, and resource lifecycle. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
e59ef85 to
093bfac
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts (1)
660-693: Split this test file before adding more cases.These additions push
mutation-executor.test.tsto ~694 lines, well past the repo’s 500-line cap for test files. Please split it along the existing boundaries here (executeNestedCreateMutation,executeNestedUpdateMutation, and scope-handling behavior) so future changes stay navigable.As per coding guidelines, "
**/*.test.ts: Keep test files under 500 lines to maintain readability and navigability. If a test file exceeds this limit, it should be split into multiple files."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts` around lines 660 - 693, The test file has grown past the 500-line guideline; split mutation-executor.test.ts into smaller files by grouping related tests: move the executeNestedCreateMutation tests (including the "reuses scope directly when runtime lacks transaction and connection" case) into a new file (e.g., mutation-executor.create.test.ts), move executeNestedUpdateMutation tests into another file (e.g., mutation-executor.update.test.ts), and place scope/transaction handling tests (the withMutationScope/runtime scope behavior cases) into a separate file (e.g., mutation-executor.scope.test.ts); ensure each new file imports the same helpers (createMockRuntime, getTestContext) and preserves the original test names and assertions so executeNestedCreateMutation, executeNestedUpdateMutation, and withMutationScope behavior tests remain unchanged functionally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/e2e/framework/test/transaction-orm.test.ts`:
- Line 47: Replace the hardcoded 30000 suite timeout by importing the shared
timeouts helper and using it in the describe call: add "import { timeouts } from
'@prisma-next/test-utils'" at the top of the file and change the describe
signature from describe('transaction ORM integration', { timeout: 30000 }, () =>
{ to describe('transaction ORM integration', { timeout: timeouts.suite }, () =>
{ so the suite uses the repo-standard timeout from the timeouts helper.
---
Nitpick comments:
In `@packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts`:
- Around line 660-693: The test file has grown past the 500-line guideline;
split mutation-executor.test.ts into smaller files by grouping related tests:
move the executeNestedCreateMutation tests (including the "reuses scope directly
when runtime lacks transaction and connection" case) into a new file (e.g.,
mutation-executor.create.test.ts), move executeNestedUpdateMutation tests into
another file (e.g., mutation-executor.update.test.ts), and place
scope/transaction handling tests (the withMutationScope/runtime scope behavior
cases) into a separate file (e.g., mutation-executor.scope.test.ts); ensure each
new file imports the same helpers (createMockRuntime, getTestContext) and
preserves the original test names and assertions so executeNestedCreateMutation,
executeNestedUpdateMutation, and withMutationScope behavior tests remain
unchanged functionally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 64bda871-9002-41d6-948e-28fa97172b8c
⛔ Files ignored due to path filters (5)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlprojects/orm-client-transaction-api/plan.mdis excluded by!projects/**projects/orm-client-transaction-api/spec.mdis excluded by!projects/**test/e2e/framework/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/fixtures/generated/contract.jsonis excluded by!**/generated/**
📒 Files selected for processing (7)
packages/3-extensions/postgres/src/runtime/postgres.tspackages/3-extensions/postgres/test/postgres.test.tspackages/3-extensions/postgres/test/transaction.types.test-d.tspackages/3-extensions/sql-orm-client/test/mutation-executor.test.tstest/e2e/framework/package.jsontest/e2e/framework/test/fixtures/contract.tstest/e2e/framework/test/transaction-orm.test.ts
093bfac to
258b2eb
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/e2e/framework/test/transaction-orm.test.ts (2)
65-66: Prefer object matchers for related value assertions.These are grouped checks of related fields; switching to
toMatchObjectwill align with test assertion conventions in this repo.♻️ Suggested patch
- expect(post!.published).toBe(true); - expect(post!.userId).toBe(user!.id); + expect(post).toMatchObject({ published: true, userId: user!.id }); @@ - expect(found!.id).toBe(created.id); - expect(found!.email).toBe('[email protected]'); + expect(found).toMatchObject({ id: created.id, email: '[email protected]' }); @@ - expect(posts[0]!.title).toBe('First Post'); - expect(posts[1]!.title).toBe('Second Post'); + expect(posts).toMatchObject([{ title: 'First Post' }, { title: 'Second Post' }]);As per coding guidelines, "
**/*.test.tsandtest/**/*.{ts,js}: Prefer object matchers (toMatchObject) over multiple individualexpect().toBe()calls when checking 2 or more related values in tests."Also applies to: 101-102, 135-136
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/e2e/framework/test/transaction-orm.test.ts` around lines 65 - 66, Replace the paired assertions on the post object with an object matcher: instead of calling expect(post!.published).toBe(true) and expect(post!.userId).toBe(user!.id), use expect(post).toMatchObject({ published: true, userId: user!.id }); apply the same change to the other occurrences mentioned (the paired assertions at lines around 101-102 and 135-136) so related fields are asserted together with toMatchObject.
2-2: Usepathefor path operations in this TypeScript test file.Line 2 imports from
node:path; this repo standardizes onpathefor cross-runtime path behavior.♻️ Suggested patch
-import { dirname, resolve } from 'node:path'; +import { dirname, resolve } from 'pathe';As per coding guidelines, "
**/*.{ts,tsx,mts,cts}: Usepatheinstead ofnode:pathfor path manipulation in TypeScript files."Also applies to: 12-13
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/e2e/framework/test/transaction-orm.test.ts` at line 2, The test imports path helpers from node:path (import { dirname, resolve }) but the repo standard uses pathe; replace the node:path import with pathe (import { dirname, resolve } from 'pathe') and update any other occurrences on lines referenced (the other imports/usages around lines 12-13) to use the pathe functions, ensuring TypeScript imports remain named as dirname and resolve so existing calls in transaction-orm.test.ts continue to work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/e2e/framework/test/transaction-orm.test.ts`:
- Around line 30-43: Wrap the connection and warm-up steps so runtime closure
always runs: move the try/finally to start before calling db.connect() and
db.orm.User.first(), or capture the runtime handle (const runtime =
db.runtime()) immediately after constructing db and call await runtime?.close()
in the finally; ensure you guard the close call if runtime is undefined and
still call it when connect or the warm-up (db.connect(), db.orm.User.first())
throws, and keep the existing callback(db) invocation inside the try block.
---
Nitpick comments:
In `@test/e2e/framework/test/transaction-orm.test.ts`:
- Around line 65-66: Replace the paired assertions on the post object with an
object matcher: instead of calling expect(post!.published).toBe(true) and
expect(post!.userId).toBe(user!.id), use expect(post).toMatchObject({ published:
true, userId: user!.id }); apply the same change to the other occurrences
mentioned (the paired assertions at lines around 101-102 and 135-136) so related
fields are asserted together with toMatchObject.
- Line 2: The test imports path helpers from node:path (import { dirname,
resolve }) but the repo standard uses pathe; replace the node:path import with
pathe (import { dirname, resolve } from 'pathe') and update any other
occurrences on lines referenced (the other imports/usages around lines 12-13) to
use the pathe functions, ensuring TypeScript imports remain named as dirname and
resolve so existing calls in transaction-orm.test.ts continue to work.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 065f1b73-f07a-415c-9e52-ecce67bc65bf
⛔ Files ignored due to path filters (5)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlprojects/orm-client-transaction-api/plan.mdis excluded by!projects/**projects/orm-client-transaction-api/spec.mdis excluded by!projects/**test/e2e/framework/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/fixtures/generated/contract.jsonis excluded by!**/generated/**
📒 Files selected for processing (7)
packages/3-extensions/postgres/src/runtime/postgres.tspackages/3-extensions/postgres/test/postgres.test.tspackages/3-extensions/postgres/test/transaction.types.test-d.tspackages/3-extensions/sql-orm-client/test/mutation-executor.test.tstest/e2e/framework/package.jsontest/e2e/framework/test/fixtures/contract.tstest/e2e/framework/test/transaction-orm.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- test/e2e/framework/package.json
- packages/3-extensions/postgres/test/transaction.types.test-d.ts
- packages/3-extensions/postgres/test/postgres.test.ts
- test/e2e/framework/test/fixtures/contract.ts
- packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
- packages/3-extensions/postgres/src/runtime/postgres.ts
258b2eb to
710cdd6
Compare
PR Stack: Transaction API
maindb.transaction()+tx.sql#345tx.orminto transactions#346Closes https://linear.app/prisma-company/issue/TML-1912/orm-transaction-support
Summary
Implements Milestone 2 of the transaction API: wiring
tx.ormso that ORM collections used inside adb.transaction()callback execute against the transaction connection. Also adds relations to the e2e fixture contract to enable nested-mutation integration tests.Implementation
The production change is surgical — ~12 lines in a single file.
PostgresTransactionContextgainsormTransaction-scoped ORM client construction
Inside
transaction(), a newormBuilder()creates an ORM client bound to the transaction'sexecute:Key design decision: The
runtimeobject passed toormBuilderexposes onlyexecute()— it deliberately omitsconnection()andtransaction(). This ensureswithMutationScopein the mutation executor naturally falls through to direct scope reuse instead of attempting a nested transaction. Zero changes to the mutation executor were needed.Tests
Unit tests (4 new)
transaction()providesormon the tx contextpostgres.test.tstx.ormis the transaction-scoped proxytx.ormhas the same type asdb.ormtransaction.types.test-d.tsexecuteNestedCreateMutation()reuses scope when runtime lackstransactionmutation-executor.test.tsexecuteon the transaction runtimewithMutationScopereuses runtime when notransactionorconnectionexistsmutation-executor.test.tsE2E integration tests (5 new — real PGlite database)
tx.orm.Post.create()with nestedauthor: (r) => r.create(...)— both rows existcreate()thenwhere().first()sees the rowE2E fixture contract changes
The fixture contract gained relations across all three models to enable nested-mutation tests:
Userposts1:N→PostUser.id→Post.userIdPostauthorN:1→UserPost.userId→User.idPostcomments1:N→CommentPost.id→Comment.postIdCommentpostN:1→PostComment.postId→Post.idThe contract definition was refactored to compose models with
rel.belongsTo()/rel.hasMany()before passing todefineContract, using lazy refs (() => Comment) for circular relations.Design patterns
{ execute }object; omittingtransaction()/connection()makeswithMutationScopefall through naturallyRuntimeQueryablepassed toormBuilderis a narrowed shape, preventing accidental nested-transaction creationdb.orm.User.first()before entering transactions to force contract verification (which needs its own connection) outside the transaction, avoiding deadlock on single-connection PGliteFiles changed
packages/3-extensions/postgres/src/runtime/postgres.ts— addtx.ormconstructionpackages/3-extensions/postgres/test/postgres.test.ts— 1 unit testpackages/3-extensions/postgres/test/transaction.types.test-d.ts— 1 type testpackages/3-extensions/sql-orm-client/test/mutation-executor.test.ts— 2 unit teststest/e2e/framework/test/transaction-orm.test.ts— 5 e2e tests (new)test/e2e/framework/test/fixtures/contract.ts— add relations to fixturetest/e2e/framework/test/fixtures/generated/contract.{d.ts,json}— regeneratedtest/e2e/framework/package.json+pnpm-lock.yaml— add@prisma-next/postgresdev depprojects/orm-client-transaction-api/{plan,spec}.md— mark M2 tasks doneSummary by CodeRabbit
New Features
Tests
Chores