【发布时间】:2021-10-12 13:18:50
【问题描述】:
model Comment {
id Int @id @default(autoincrement())
reply Comment? @relation(fields: [replyId], references: [id], onDelete: SetNull)
replyId Int? @default(null)
comment String
}
这里reply 和replyId 都可以为空,但是当我尝试迁移时出现此错误:
error: Error parsing attribute "@default": Expected a numeric value, but received literal value "Null".
--> schema.prisma:70
|
69 | reply Comment? @relation(fields: [replyId], references: [id], onDelete: SetNull)
70 | replyId Int? @default(null)
|
谁能解释一下这个问题?
【问题讨论】: