A reproducible example of a schema inconsistency issue when using Prisma with PostgreSQL.
When using Prisma with PostgreSQL, if the connection string specifies a schema other than 'public', the generated queries will still reference the 'public' schema unless the schema option is explicitly set in the adapter configuration.
This leads to query failures unless all raw queries are also prefixed with the specified schema, as the search path does not include the specified schema by default.
This issue does not occur when using prisma-client-js without an adapter.
- Clone the repository.
- Install dependencies using
pnpm install. - Run the included
docker-compose.ymlto initialize a database instance. - Run
pnpm prisma migrate deployto apply the migrations. - Run
pnpm prisma generateto generate the Prisma client. - Run both scenarios with
pnpm start:scenario-1andpnpm start:scenario-2to reproduce the schema inconsistency issue.
The queries should respect the schema defined in the connection string.
Queries generated by the ORM will fail due to all tables being prefixed with the 'public.' schema, despite the connection string specifying a different schema, unless the schema option is explicitly set in the adapter configuration.
Even with the schema option set, any raw queries ($executeRaw, $executeRawUnsafe) that are not prefixed with the schema will fail, due to the search path not including the specified schema.
- Prisma version: 6.16.2
- Node.js version: 22.18