Social media database (DBML)
The classic social schema is a good example because it contains both a self-referencing many-to-many and a polymorphic-looking relationship handled honestly.
#What this example shows
A join table for follows, referencing the same table twice.
Composite primary keys on join tables.
Separate like tables rather than a polymorphic one.
#A worked example
Open it, edit it, or copy the source below.
The source, which you can paste into a new diagram and edit:
#Making it your own
Two references to the same table is how you model a directed relationship between peers.
A composite primary key on a join table prevents duplicates for free.
Resist a polymorphic likes table; separate tables keep the foreign keys real.
#Related
Close enough to the schema to stay true.
