Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Output Schema #86

Open
TheHackerClown opened this issue Oct 23, 2024 · 0 comments
Open

Error in Output Schema #86

TheHackerClown opened this issue Oct 23, 2024 · 0 comments

Comments

@TheHackerClown
Copy link

The Issue is when you reference a foreign key to a table, for example- User and Chat
the generated schema with error is given below
model User {
id Int @id @unique @default(autoincrement())
Username String @unique
}
model Chat {
id String @id @unique @default(uuid())
createdOn DateTime @default(now())
MadeBy User
Content String
}

as you can see the Madeby in Chat Model will throw an error as no field was specified for reference, and in the User Model, The Chats were not reverse referenced,
see the code with no error is given below,

model User {
id Int @id @unique @default(autoincrement())
Username String @unique
Chat Chat[]
}
model Chat {
id String @id @unique @default(uuid())
createdOn DateTime @default(now())
MadeBy Player @relation(fields: [id], references: [Username])
Content String
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant