Mathieu
05/23/2022, 9:31 PMmodel User {
id String @id(map: "PK_cace4a159ff9f2512dd42373760") @default(dbgenerated("gen_random_uuid()")) @db.Uuid
username String @unique(map: "UQ_78a916df40e02a9deb1c4b75edb") @db.VarChar
email String? @unique(map: "UQ_e12875dfb3b1d92d7d7c5377e22") @db.VarChar
password String @db.VarChar
sheet Sheet[]
@@index([username], map: "username-idx")
@@map("user")
}
model Sheet {
id String @id() @default(dbgenerated("gen_random_uuid()")) @db.Uuid
author User @relation(fields: [authorId], references: [id])
authorId String @db.Uuid
name String @unique() @db.VarChar(512)
slug String @unique() @db.VarChar(512)
}
When running npx prisma migrate dev --name sheets
I get:
Migration `20220523212222_sheets` failed to apply cleanly to the shadow database.
Error:
db error: ERROR: foreign key constraint "Sheet_authorId_fkey" cannot be implemented
DETAIL: Key columns "authorId" and "id" are of incompatible types: text and uuid.
But I thought this line in the Sheet model was correct?
authorId String @db.Uuid
Mathieu
05/23/2022, 9:40 PM