How to declare optional one-to-one relationship
I have 2 tables that relate to each other in an inverse manner:
If I go ahead and create a user without a profile in Studio, no error is shown. However, when I run the following script during runtime, unexpected errors may appear.
I understand that I could fix this by updating my schema relationships and linking a profile ID in the users table but, given that I have many tables that relate to individual users where table information may or may not exist (e.g. profile, KYC data, KYB data, etc.), I thought this would be the best way to design it.
If I go ahead and create a user without a profile in Studio, no error is shown. However, when I run the following script during runtime, unexpected errors may appear.
I understand that I could fix this by updating my schema relationships and linking a profile ID in the users table but, given that I have many tables that relate to individual users where table information may or may not exist (e.g. profile, KYC data, KYB data, etc.), I thought this would be the best way to design it.