-
-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Labels
Description
Description and expected behavior
Auth user type (@@auth) is being stripped away by Prisma 6.18.0, probably because it isn't actively used in a model.
If you define the auth user type with a type instead of model, it is no longer added to the "logical-prisma-client". For example:
type AuthUser {
id String @id
name String?
@@auth
}This will result in an error in the zenstack enhance file:
export namespace auth {
type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
export type AuthUser = WithRequired<Partial<_P.AuthUser>, 'id'> & Record<string, unknown>;
}_P.AuthUser will be undefined.
Solution
I think Zenstack should use the generated JSON type (from json-types.ts) when a type is used instead of a model.
Workaround
I had to switch back to using a model and mark it as an external table:
model AuthUser {
id String @id
name String?
@@auth
@@map("_user_auth_placeholder")
}// prisma.config.ts
import path from 'node:path';
import { defineConfig, env } from 'prisma/config';
export default defineConfig({
schema: path.join('schema', 'prisma', 'schema.prisma'),
migrations: {
path: path.join('migrations'),
},
experimental: {
externalTables: true,
},
tables: {
external: ['public._user_auth_placeholder'],
},
});Environment:
- ZenStack version: 2.21.0
- Prisma version: 6.18.0
- Database type: Postgresql