Conversation
Removes unused dependencies <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Removed unused development dependencies to streamline the build process. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
) ## Summary This PR adds a regression test for a critical bug where BigInt values lose precision when using driver adapters (like `@prisma/adapter-pg`) with the `relationJoins` preview feature enabled. Fixes #29010 ### The Problem When `previewFeatures = ["relationJoins"]` is enabled, Prisma uses lateral joins to fetch related data. The related records are returned as JSON-aggregated columns. When parsing this JSON data, standard `JSON.parse()` converts large integers (exceeding `Number.MAX_SAFE_INTEGER`) to JavaScript Numbers, silently corrupting the values. **Example corruption:** - Original value: `312590077454712834` - After JSON.parse: `312590077454712800` (precision lost!) ### The Fix The fix is implemented at the SQL level in `prisma-engines`: - Postgres: cast BigInt to text in `JSONB_BUILD_OBJECT` (prisma/prisma-engines#5745) - MySQL + CockroachDB: cast BigInt/INT8 values to string in JSON builders (prisma/prisma-engines#5752) BigInt columns are cast to string before JSON aggregation, so values arrive as strings and are correctly parsed without precision loss. **Changes in this PR:** - Added regression test in `packages/client/tests/functional/issues/29010-bigint-precision-relation-joins/` - Minor type safety improvement (explicit `as Value` cast) in `data-mapper.ts` ## Reproduction <details> <summary>Schema</summary> ```prisma generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters", "relationJoins"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id BigInt @id @default(autoincrement()) files UserFile[] } model UserFile { id String @id @default(uuid()) userId BigInt user User @relation(fields: [userId], references: [id]) } ``` </details> <details> <summary>Test Code</summary> ```typescript // Create test data const user = await prisma.user.create({ data: {} }) const file = await prisma.userFile.create({ data: { userId: user.id } }) // Fetch with include (triggers relationJoins) const result = await prisma.userFile.findUnique({ where: { id: file.id }, include: { user: true } }) // Before fix: result.userId !== result.user.id (BigInt corrupted in nested relation) // After fix: result.userId === result.user.id (correct) ``` </details> ## Test Plan - [x] Regression test added for BigInt precision in relationJoins queries - [x] Test covers PostgreSQL, CockroachDB, and MySQL (requires updated Wasm artifacts from prisma-engines#5752) - [x] Tests nested relationJoins queries ## Breaking Changes None. This is a bugfix that preserves intended behavior. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved JSON data parsing and type handling in data mapping operations. * **Tests** * Added comprehensive test coverage for BigInt precision with relationJoins across PostgreSQL, CockroachDB, and MySQL database providers. <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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )