Add a way to programmatically check if a field is nullable #24022
Labels
kind/improvement
An improvement to existing feature and code.
team/client
Issue for team Client.
topic: dmmf
topic: schema metadata
Metadata to allow advanced commenting or protection of certain parts of a schemas
Problem
I want to programmatically check if a field is nullable or not.
I want to integrate a third party filter with a query using an dynamic order by, something like:
The problem is that the order by typing depends if the field is nullable or not (so that we can include de null last or first thing):
And there is no way to know if the field is nullable or not programmatically, so I cant make it 100% dynamic.
Suggested solution
Maybe add on the FieldRef interface a field to check if the field is required:
That way I could check with
prismaClient.myEntity.fields[sortByField.field].isNullable
The text was updated successfully, but these errors were encountered: