Import Rails schema.rb
Paste your Rails app's db/schema.rb into DrawSQL and get an ERD of your whole app — Rails shorthand like t.references and t.timestamps is expanded into the real columns, indexes, and relationships it creates.
Grab your schema file
It's already in your repo at db/schema.rb — Rails keeps it current every time you migrate. To regenerate it from your database:
bin/rails db:schema:dump
App uses db/structure.sql instead (schema_format = :sql)? Import that file with the SQL import — it works the same way.
Import it
In the diagram editor, click File → Import — or open the /draw playground to try it without an account.
Paste the file, upload it — or switch to the GitHub tab and paste your repo's URL. For public repos, DrawSQL finds
db/schema.rbon its own.Click Begin Import and review the log.
DrawSQL detects whether the schema came from MySQL or PostgreSQL and resolves column types for that DBMS. Importing into an existing diagram uses the diagram's DBMS; on /draw you can override the target with the into <DBMS> control.
What gets imported
Every
create_tableblock — including the implicitidprimary key, UUID primary keys, andid: falsetablest.timestamps→created_atandupdated_att.references/t.belongs_to→ the_idcolumn with its index, plus a relationship when a foreign key is definedadd_foreign_keystatements — drawn as relationshipsIndexes, including unique and multi-column ones
Composite primary keys (Rails 7.1+)
Known limits
Anything that can't be represented is skipped and flagged in the import log:
Polymorphic references import their
_idand_typecolumns, but no relationship line — there's no single target table to point atPartial (
where:) and expression indexesType modifiers like
limit,precision, andscale— the base type is keptRidgepole Schemafiles — they look like
schema.rbbut are arbitrary Ruby, and aren't supported