I have a design question: given that it is often s...
# off-topic
c
I have a design question: given that it is often suggested to store profile info in a separate table from auth.users (and link that profile table to auth users) and assuming that most apps do NOT allow signed-in users to interact with the app without a completely setup profile - do you think it's better to link the user's items to a record in the custom profile table or directly to auth.users table?
It seems to me that it is better to link to the custom profile table because: - it is a bit less error prone - linking to profile would enforce that a profile is setup before any items are created by the user; - it is easier to migrate to another PG/cloud provider - it would be easier to migrate to another db/cloud provider if the only link to an "external" table (i.e. a table NOT created by me) is from profile to auth.user instead of from all other tables to auth.users - hypothetically, a user might be able to setup multiple profiles and this way, you can assign items to the different profiles (which might have different permissions, etc)
The biggest drawback of this approach is that it makes it harder to store data about the user BEFORE they had setup a profile, e.g. users might sign up with invite codes and recording the usage of that code will either need to be recorded ONLY after the profile is setup (which can be a bit problematic if the code can be used only one) or there would still be tables pointing to auth.users, it will just be fewer of them
what does the wisdom of Discord think?
g
I also like that I can allow a user to be deleted from auth and I can control what happens to tables linked to the "profile" table. For instance null the profile data for deleted user but still allow content to remain with an "anon" as owner if desired.
c
indeed, I hadn't thought about that