Saturday, August 2, 2014

Twitter ERD

I was curious if there are tools that can automatically generate entity relation diagrams (ERDs). I found three (schemacrawler, rails-erd, and railroady). In general, however, it doesn't seem like that many people are interested.

In any case, I applied these tools to the mock Twitter (https://github.com/misha354/twitter) that my instructor at Tealeaf Academy is building as a live-coding demonstration. Here are the results:

schemacrawler:




I like the visuals, but the main limitation of this tool is in the name. It only maps the database schema and doesn't know about associations defined at the model layer. In fact, it's pretty smart and can infer associations from table and column names (like the association between mentions and users). But if the foreign key column isn't named after the table it references (like in the relationships-users associations), the association is lost on schemacrawler. In addition, not seeing the model layer, schemacrawler obviously doesn't see indirect associations like leader user -> relationship user -> follower user.

rails-erd:

It appears that this gem is no longer maintained. But it's still up on github. Here is its ERD:


rails-erd does see associations at the model layer, so it shows us that relationships points to the users table and that user has two indirect

No comments:

Post a Comment