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

[FEATURE] - Support nulling or clearing a related field #471

Closed
minism opened this issue Oct 4, 2024 · 1 comment
Closed

[FEATURE] - Support nulling or clearing a related field #471

minism opened this issue Oct 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@minism
Copy link

minism commented Oct 4, 2024

Summary

For tables with nullable foreign keys, I am able to set the value in the edit view, but not clear it. Clicking the "X" next to the select input to clear it and saving the form results in the old value persisting. There doesn't seem to be a way to clear or set the field back to null - is this a missing feature?

Basic Example

I have two tables configured in prisma as so:

model users {
  id                       String                     @id
  email                    String?
  purchasable_packages     purchasable_packages[]
}

model purchasable_packages {
  id                 Int                 @id @default(autoincrement())
  num_requests       Int
  custom_for_user_id String?
  users              users?              @relation(fields: [custom_for_user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
}

custom_for_user_id is a nullable column, and so users is a nullable relation field.

Drawbacks

No response

Unresolved questions

No response

@minism minism added the enhancement New feature or request label Oct 4, 2024
@cregourd cregourd mentioned this issue Oct 7, 2024
8 tasks
@cregourd
Copy link
Collaborator

cregourd commented Oct 7, 2024

Hi, thanks for your feedback.
A patch is available on v6.1.6 🚀

Feel free to give us any other feedback

@cregourd cregourd closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants