-
Notifications
You must be signed in to change notification settings - Fork 12
Description
So this might be a niche issue but I wanted to see if there is a good solution.
We have user avatars but instead of uploading a picture they choose from a collection. This collection is called Avatars. We have added a field to directus_users that references the Avatar collection in a field called our_avatar. We have one default avatar that each user get's until they chose a different one. The id of this avatar is 1. So we set the default value of the our_avatar field to 1.
Now the problem: The avatars are created/imported only after the directus_users collection is updated. This causes a INVALID_FOREIGN_KEY because no Avatar with id 1 exists yet.
We haven't yet found a solution. Maybe we shouldn't really change the directus_users collection and instead have a 1-to-1 relation with something like UserCustomzation? I'd be glad to hear what you suggest. I haven't found a way to only change the default value after the avatars are imported.