antho
September 27, 2024, 11:54am
1
Hello Team,
I try to create a new app using supabase as backend.
I want to create a user and this user will be associated to a group.
I have already created groups table with foreign key auth.user(id)
Starting simple, a user can be associated to one group.
If I create a task in “task” table from Webweb, I want this task is associated to a group.
All users linked attached on this group could view tasks.
I don’t know how to send group ID when I create my task.
Could you help me ?
Do you have a group_id column? Could you share more of your schema?
antho
September 27, 2024, 3:15pm
3
Yes sure.
The schema is simple for the moment
antho
September 27, 2024, 3:25pm
6
the target is :
Users could be associated with one or more groups.
I prefer to start simply to understand the concept and try something more complicated
You would need a table user_groups, it’s a juction table for a M:M (many to many) relationship.
CREATE TABLE user_groups (
user_id uuid, -- This would be the auth.users.id or the profile.id
group_id uuid -- This is the group the user is associated to
)