Skip to content

Commit ecc8fad

Browse files
committed
fix: generated prisma schema contains error when using "@@unique" with base field
Fixes #1758
1 parent 2d42606 commit ecc8fad

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { loadModelWithError } from '@zenstackhq/testtools';
2+
3+
describe('issue 1758', () => {
4+
it('regression', async () => {
5+
await expect(
6+
loadModelWithError(
7+
`
8+
model Organization {
9+
id String @id @default(cuid())
10+
contents Content[] @relation("OrganizationContents")
11+
}
12+
13+
model Content {
14+
id String @id @default(cuid())
15+
contentType String
16+
organization Organization @relation("OrganizationContents", fields: [organizationId], references: [id])
17+
organizationId String
18+
@@delegate(contentType)
19+
}
20+
21+
model Store extends Content {
22+
name String
23+
@@unique([organizationId, name])
24+
}
25+
`
26+
)
27+
).resolves.toContain('Cannot use fields inherited from a polymorphic base model in `@@unique`');
28+
});
29+
});

0 commit comments

Comments
 (0)