Hello everyone. CAn Anyone help me with one-to-man...
# help
j
Hello everyone. CAn Anyone help me with one-to-many relationship? In users I've created posts_id row (pic 1) and then relation between posts_id and posts (pic 2) , but it seems its not working. I can not iterate from users to posts to see which post the user made.
n
Hello ! This thread has been automatically created from your message in a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g
Foreign keys go the other way. You should have user_id in the posts table that points back to users table (id). 2nd. Is that the auth.users table? It is highly recommended not to modify the structure of that table.
n
JR23 (2022-03-24)
j
@User hello . thanks for your anwser. I will give it a try.
maybe a profiles table?
g
You can use foreign keys ON users.auth, they don't modify it, they just link the user id (or whatever column) to the table with the foreign key. Just don't change the columns in auth.users.
j
ok
I'have tried to access the email with fk and this error produces and I dont know why. (god I really love the way to deal with this kinda of things when we make all tables in SQL editor)
g
It has to be linked to a primary key.
n
Thread was archived by @JR23. Anyone can send a message to unarchive it.