Skip to content

[pull] main from prisma:main#226

Merged
pull[bot] merged 4 commits intocode:mainfrom
prisma:main
Mar 17, 2026
Merged

[pull] main from prisma:main#226
pull[bot] merged 4 commits intocode:mainfrom
prisma:main

Conversation

@pull
Copy link

@pull pull bot commented Mar 17, 2026

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 : )

Not-Sarthak and others added 4 commits March 17, 2026 12:34
#29287)

## Summary

- Adds support for passing a raw connection string URL directly to
`PrismaPg` (e.g., `new PrismaPg(process.env.DATABASE_URL)`)
- The constructor now accepts `pg.Pool | pg.PoolConfig | string`,
converting strings to `{ connectionString: string }` internally
- This is a convenience feature — `pg.PoolConfig` already supports `{
connectionString: '...' }`, but accepting a plain string is more
ergonomic

Related: #29151

## Test plan

- [x] Added unit test verifying `PrismaPgAdapterFactory` accepts a
connection string URL and creates a working adapter
- [x] All existing adapter-pg tests pass (36/36)
- [x] Lint passes with no new warnings

> **Note:** The CodSpeed regression (`compile findUnique -97.77%`) is
unrelated — this PR only touches `adapter-pg` constructor logic, not
query compilation.
…29346)

## Summary

- Adds `export` keyword to the `Get<Model>GroupByPayload` type in
`client-generator-ts` so it's accessible to users after generation

Fixes #29345

## Problem

In the `prisma-client` generator (Prisma 7), `Get<Model>GroupByPayload`
is defined as a **private type** in each model file:

```typescript
// generated/models/MealInteraction.ts
export type MealInteractionGroupByArgs = { ... }        // ✅ exported
export type MealInteractionGroupByOutputType = { ... }   // ✅ exported
type GetMealInteractionGroupByPayload<T> = ...           // ❌ NOT exported
```

In the old `prisma-client-js` generator, this type was accessible via
the `Prisma` namespace
(`Prisma.GetMealInteractionGroupByPayload<{...}>`). With the new
per-model-file architecture, the missing `export` makes it completely
unreachable.

## Fix

One-line change in `packages/client-generator-ts/src/TSClient/Model.ts`:

```diff
-type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma.PrismaPromise<
+export type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma.PrismaPromise<
```

## Test plan

- [ ] Run `prisma generate` with `prisma-client` generator
- [ ] Verify `GetMealInteractionGroupByPayload` is now exported from the
generated model file
- [ ] Verify it can be imported from the models barrel export
- [ ] Verify `Awaited<GetMealInteractionGroupByPayload<{ by: [...],
_count: {...} }>>` resolves correctly

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* The GroupBy payload type is now publicly exportable and can be
imported for use in your TypeScript applications.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…onstant (#29317)

## Summary

Closes #29316

Extracts the hardcoded `'prisma-client-js'` string literal into a shared
`PRISMA_CLIENT_JS_PROVIDER` constant defined in `@prisma/internals`,
replacing all occurrences across the codebase.

### Changes

- **New**: `packages/internals/src/prisma-client-js-provider.ts` —
single source of truth for the constant
- **Modified** (8 files across 4 packages):
  - `packages/internals/src/index.ts` — export the constant
- `packages/internals/src/cli/getGeneratorSuccessMessage.ts` — use
constant
- `packages/internals/src/utils/extractPreviewFeatures.ts` — use
constant
  - `packages/cli/src/Generate.ts` — use constant (2 occurrences)
  - `packages/cli/src/utils/checkpoint.ts` — use constant
  - `packages/client-generator-js/src/generator.ts` — use constant
- `packages/client-generator-js/src/utils/types/dmmfToTypes.ts` — use
constant (2 occurrences)
  - `packages/client/src/utils/getTestClient.ts` — use constant

### Motivation

This was identified during the review of #29315 by @coderabbitai. Having
a single constant:
- Eliminates risk of typos in the provider string
- Makes it easy to find all usages via "Find References"
- Provides a single place to update if the value ever changes

## Test plan

- [x] `pnpm build` passes (43 tasks)
- [x] `getGenerators` tests pass (40/40, 33 snapshots)
- [x] No behavioral changes — pure mechanical refactor

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Standardized provider identifiers across internal modules using a
centralized constant.
* No changes to behavior or public APIs; end-user experience remains
unchanged.
* Improved internal consistency and reliability of provider detection
and generator selection logic.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…tFound error (#29307)

This pull request improves the handling and testing of PostgreSQL
"ColumnNotFound" errors in the adapter. The main focus is on correctly
extracting column names from error messages, regardless of whether the
column name is quoted, and ensuring the tests cover both scenarios.

We were getting "The column `(not available)` does not exist in the
current database" error all the time, the sql was trying to get
qualified name (e.g. schema.table_name) which generated postgres error
message without quotes:
`column table.column does not exist` vs `column "column" does not
exist`.
Our setup included:
- multi-schema DB
- custom @@Map() fields.
- Postgres v18.3

Error handling improvements:

* Updated the `mapDriverError` function in `errors.ts` to strip quotes
from column names when parsing "ColumnNotFound" (42703) errors, ensuring
consistent extraction of the column name.

Testing enhancements:

* Added a new test case for handling unquoted column names and clarified
the description of the existing test for quoted column names in
`errors.test.ts`, ensuring both cases are covered for "ColumnNotFound"
errors.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved detection and normalization of PostgreSQL "column not found"
errors so column names are identified correctly for unquoted, quoted,
qualified, spaced, and escaped-quote formats, providing clearer,
consistent error details.

* **Tests**
* Added comprehensive tests covering many column-name formats to ensure
accurate detection and unchanged original error messaging.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@pull pull bot locked and limited conversation to collaborators Mar 17, 2026
@pull pull bot added the ⤵️ pull label Mar 17, 2026
@pull pull bot merged commit 33667c3 into code:main Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants