Comment Your Columns
Similarly to how we added an extra parameter for keys, there’s one final parameter reserved for column comments. They’re completely optional but can be handy if you need to explain something about a particular column—such as specifying a foreign key. Here’s what it looks like in Mermaid if we add a comment to specify the missing foreign keys from the TITLE_GENRE entity:
| TITLE_GENRE { |
| int title_id PK "FK" |
| int genre_id PK "FK" |
| } |
If we add the remaining missing keys, and comments where necessary, our ERD looks like this:
I think this is a good compromise, and it renders nicely. Don’t be afraid to add both a foreign key and ...
Get Creating Software with Modern Diagramming Techniques now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.