Skip to content

MySQL & Postgres

DBML comes with a built-in CLI which can be used to convert between different formats from the command line. We can use it in par with FloorPlan to generate ER diagrams for both MySQL and Postgres databases.

First, we must translate our .sql files into .dbml files by using the CLI tools.

Install DBML's CLI with:

npm install -g @dbml/cli

And convert your schema dump:

# for a Postgres DB:
sql2dbml --postgres dump.sql -o mydatabase.dbml

# or for MySQL
sql2dbml --mysql dump.sql -o mydatabase.dbml

The .dbml output can be passed into FloorPlan for the ER diagram generation.