Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 5667acd

Browse files
Copilotymc9
andauthored
test: verify "public" schema not required when all models have explicit @@Schema (#496)
* Initial plan * Add test for explicit schema usage without public Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
1 parent 94b69b7 commit 5667acd

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

tests/e2e/orm/client-api/pg-custom-schema.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,44 @@ model Bar {
278278
).rejects.toThrow('"public" must be included in the "schemas" array');
279279
});
280280

281+
it('does not require public schema when all models and enums have explicit schema', async () => {
282+
const db = await createTestClient(
283+
`
284+
datasource db {
285+
provider = 'postgresql'
286+
schemas = ['mySchema']
287+
url = '$DB_URL'
288+
}
289+
290+
enum Role {
291+
ADMIN
292+
USER
293+
@@schema('mySchema')
294+
}
295+
296+
model Foo {
297+
id Int @id
298+
name String
299+
role Role
300+
@@schema('mySchema')
301+
}
302+
303+
model Bar {
304+
id Int @id
305+
name String
306+
@@schema('mySchema')
307+
}
308+
`,
309+
{
310+
provider: 'postgresql',
311+
usePrismaPush: true,
312+
},
313+
);
314+
315+
await expect(db.foo.create({ data: { id: 1, name: 'test', role: 'ADMIN' } })).toResolveTruthy();
316+
await expect(db.bar.create({ data: { id: 1, name: 'test' } })).toResolveTruthy();
317+
});
318+
281319
it('allows specifying schema only on a few models', async () => {
282320
let fooQueriesVerified = false;
283321
let barQueriesVerified = false;

0 commit comments

Comments
 (0)