- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 125
 
Closed
Labels
Milestone
Description
Cannot put index in abstract model used by delegate model.
See https://github.com/eqqe/reprod-zenstack for reproduction.
model User {
    id       String @id @default(cuid())
    email    String @unique @email @length(6, 32)
    password String @password @omit
    contents    Content[]
    // everybody can signup
    @@allow('create', true)
    // full access by self
    @@allow('all', auth() == this)
}
abstract model BaseContent {
  published Boolean @default(false)
  @@index([published])
}
model Content extends BaseContent {
    id       String @id @default(cuid())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  owner User @relation(fields: [ownerId], references: [id])
  ownerId String
  contentType String
  @@delegate(contentType)
}
model Post extends Content {
  title String
}
model Video extends Content {
  name String
  duration Int
}
⌛️ ZenStack CLI v2.7.0, running plugins
Prisma schema loaded from prisma\schema.prisma
Error: Prisma schema validation - (get-dmmf wasm)
Error code: P1012
error: Error validating model "Post": The index definition refers to the unknown fields: published.
  -->  prisma\schema.prisma:48
   |
47 |
48 |     @@index([published])
   |
error: Error validating model "Video": The index definition refers to the unknown fields: published.
  -->  prisma\schema.prisma:57
   |
56 |
57 |     @@index([published])
   |
Validation Error Count: 2
[Context: getDmmf]
Prisma CLI Version : 5.21.0
✖ Generating Prisma schema
Prisma: Failed to run "prisma generate"```
ymc9

