Rails comes with a schema.rb file that contains a clear definition of your database tables and how they're linked together. But what if you want to generate an entity-relationship diagram (ERD) of your Rails app to quickly get a sense of how they look?
Since we launched dbdiagram.io, a free and simple tool to draw entity relationship diagram 4 weeks back, we've been getting tons of feedback. Among those, a lot of people are asking if we support integrations with Rails, Django, or Laravel.
So today I'm excited to share that we've fulfilled one of the first steps: we now support Rails! If you are a Rails developer, you can quickly generate a database relationship diagram (or ERD diagram) from your schema.rb, in just 3 simple steps:
- Open dbdiagram.io
- Click Import → From Rails (schema.rb)
- Paste (or upload) your schema.rb
Some cool features that the tool has:
- Auto recognize your Rails relationship: It reads both explicit and implicit foreign key definitions (and convention), then translates them to the correct relationships. Explicit definitions like
t.references 'user'are recognized; implicit (convention) definition like
t.integer user_idare also recognized!
- You can generate a beautiful PDF file afterwards.
- It's completely free!
If you want to give it a try, go to dbdiagram.io and upload your schema.rb to see how your rails erd diagram look.
Subscribe to Holistics Blog
Get the latest posts delivered right to your inbox
From SQL Queries To Beautiful Charts
Connect to your database and build beautiful charts with Holistics BILearn More
"Holistics is the solution to the increasingly many and complex data requests from the operational teams"
Tang Yee Jie
Senior Data Analyst, Grab