dbdocs now supports Many-to-many Relationships !
When drawing the many-to-many relationship, you no longer need to create an associative (join) table. Instead, just define it directly, such as:
Table books {
id int [pk]
...
}
Table authors {
id int [pk]
...
}
Ref books_authors: books.id <> authors.id // many-to-many
For more DBML syntax updates, please check out our docs !
From dbdocs team with
Often the associative table has its own attributes, in that case, the table would have to be defined explicitly.
1 Like
Yes, you are correct. That is why we backed both scenarios. You can also use two 1-n relationships and an associative table to document the n-n relationships.
In this post, we will be sharing with you a tip on how to define many-to-many relationships in dbdiagram.
Update Jun 2022: We have supported the native many-to-many relationtionship syntax. This post has been updated with the new example.
Ref: authors.id <> posts.id
Many-to-many Relationship
You can define a many-to-many relationship in two ways:
Directly define the many-to-many relationship with the native many-to-many relationship definition
Use two alternative one-to-many relationship…