I have two tables, users and sites. Users can hold...
# orm-help
e
I have two tables, users and sites. Users can hold multiple sites, sites can hold multiple users. How would I use Prisma client if I want to add a site to a user?
p
According to <https://www.prisma.io/docs/concepts/components/prisma-schema/relations#many-to-many-relations> you're able to connect it multiple ways - either using the connect keyword, or by setting the [reference_id] property in the table.
An example could be - taken from my own setup
post.create({
            
data: {
                
title,
                
content,
                
userId: 3,
            
},
            
include: { author: true },
        
});
Notice the userId property, which is a reference to the user table, where I then include the author for a "related" query