Trying to use a polymorphic model with a base object that includes an abstract model.
type BaseEntity {
id String @id @default(ulid())
createdOn DateTime @default(now())
updatedOn DateTime @updatedAt
isDeleted Boolean @default(false)
isArchived Boolean @default(false)
}
model RoutineData with BaseEntity {
dataType DataType
sortOrder Float?
title String?
routineId String
Routine Routine @relation(fields: [routineId], references: [id])
@@delegate(dataType)
@@allow('all', auth().id == Routine.userId)
}
model DataText extends RoutineData {
text String
}
Reading DataText object fails with 'dataText.createdOn' does not exist. This pattern worked with V2.
I was able to make it work by copying the BaseEntity rows into the RoutineData table directly.
model RoutineData {
id String @id @default(ulid())
createdOn DateTime @default(now())
updatedOn DateTime @updatedAt
isDeleted Boolean @default(false)
isArchived Boolean @default(false)
dataType DataType
sortOrder Float?
title String?
routineId String
Routine Routine @relation(fields: [routineId], references: [id])
@@delegate(dataType)
@@allow('all', auth().id == Routine.userId)
}
model DataText extends RoutineData {
text String
}
Trying to use a polymorphic model with a base object that includes an abstract model.
Reading DataText object fails with 'dataText.createdOn' does not exist. This pattern worked with V2.
I was able to make it work by copying the BaseEntity rows into the RoutineData table directly.