Query API relation null type
Hi I am using query API to fetch data. I defined my schema.
My schema is something like that
query response type says media is always an object, but it can be null if there is no media data
3 Replies
@AuroPick since you are defining a one-to-one relationship check out this page https://orm.drizzle.team/docs/rqb#one-to-one
Note with the second example it says
Another example would be a user having a profile information stored in separate table. In this case, because the foreign key is stored in the “profile_info” table, the user relation have neither fields or references. This tells Typescript that user.profileInfo is nullableSo you can simply define the relationship as:
media: one(chatMedia)
Hi @Aaroned,
thanks, are chat media relations correct? I do not need to change them either, do I?
Yes chat media relations is correct