From 2790ec2c9b5d0e70dca34dbe6b05da8b62f1c2b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 06:36:58 +0000 Subject: [PATCH 1/2] Initial plan From 57b7d6cb0f84224047f4f2077172bfa163bbc419 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 06:43:42 +0000 Subject: [PATCH 2/2] Add test for explicit schema usage without public Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> --- .../orm/client-api/pg-custom-schema.test.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/e2e/orm/client-api/pg-custom-schema.test.ts b/tests/e2e/orm/client-api/pg-custom-schema.test.ts index 3bc746de0..dfe6fe895 100644 --- a/tests/e2e/orm/client-api/pg-custom-schema.test.ts +++ b/tests/e2e/orm/client-api/pg-custom-schema.test.ts @@ -278,6 +278,44 @@ model Bar { ).rejects.toThrow('"public" must be included in the "schemas" array'); }); + it('does not require public schema when all models and enums have explicit schema', async () => { + const db = await createTestClient( + ` +datasource db { + provider = 'postgresql' + schemas = ['mySchema'] + url = '$DB_URL' +} + +enum Role { + ADMIN + USER + @@schema('mySchema') +} + +model Foo { + id Int @id + name String + role Role + @@schema('mySchema') +} + +model Bar { + id Int @id + name String + @@schema('mySchema') +} +`, + { + provider: 'postgresql', + usePrismaPush: true, + }, + ); + + await expect(db.foo.create({ data: { id: 1, name: 'test', role: 'ADMIN' } })).toResolveTruthy(); + await expect(db.bar.create({ data: { id: 1, name: 'test' } })).toResolveTruthy(); + }); + it('allows specifying schema only on a few models', async () => { let fooQueriesVerified = false; let barQueriesVerified = false;