Moving a dbdiagram.io Schema to a Connected Model
Moving from Code-First DBML to a Connected Model
dbdiagram.io provides an accessible web editor for drafting schemas using Database Markup Language (DBML) code. Developers worldwide have created over 3M diagrams on the platform to document database structures quickly[1].
A code-first browser diagram reaches its limits when your application moves into active development. The tool operates as an isolated visual canvas without direct database connections, automated schema introspection, or bidirectional deployment workflows.
DbSchema bridges this gap by turning static table definitions into an offline-first design model that connects directly to live database engines. You can evaluate the transition using dbdiagram.io alternatives to understand how connected tooling fits your development pipeline.
- DbSchema: Stores schema architecture in a local, Git-friendly XML model file for offline editing.
- DbSchema: Connects directly to SQL and NoSQL engines through JDBC to compare schemas and deploy migration scripts.
- dbdiagram.io: Isolates schema definitions inside a browser-hosted DBML editor without live database connectivity.
- dbdiagram.io: Requires manual copy-pasting or CLI scripts to sync schema modifications with target servers.
Migrating your schema out of dbdiagram.io and into a connected modeller requires an intermediate SQL export. This guide details the exact export path, identifies preserved metadata, outlines layout adjustments, and explains how to synchronize your model against a live database.
Exporting Your dbdiagram.io Schema to SQL
The bridge out of dbdiagram.io is a standard SQL Data Definition Language (DDL) export. You generate this script directly from the dbdiagram.io web interface or by using the open-source DBML command-line interface.
The dbdiagram.io exporter supports 4 relational SQL dialects: PostgreSQL, MySQL, SQL Server (MSSQL), and Oracle[2]. Choose the dialect that matches your target database engine to ensure accurate data type mapping and constraint syntax.
| Target Database Dialect | Export Format | dbml2sql CLI Flag |
|---|---|---|
| PostgreSQL | Standard Postgres DDL script | --postgres (the CLI default) |
| MySQL | Standard MySQL DDL script | --mysql |
| Microsoft SQL Server | T-SQL DDL script | --mssql |
| Oracle Database | Oracle DDL script | --oracle |
Follow these steps to generate the SQL file from the web interface:
- Open your project inside the dbdiagram.io canvas editor.
- Click the Export button in the top navigation header.
- Select your target SQL dialect from the dropdown menu (e.g., Export to PostgreSQL).
- Save the generated .sql file to a directory within your project repository.
What Carries Over: Tables, Keys, and Relations
Relational schema logic transfers cleanly through the SQL DDL intermediate export. A modelling tool parses standard SQL statements to reconstruct your complete entity-relationship model.
- Table structures: CREATE TABLE statements map directly to visual table entities.
- Column specifications: Column names, native data types, nullability rules, and default values carry over completely.
- Primary keys: Single-column and composite PRIMARY KEY constraints are fully recognized.
- Foreign keys: Relational references defined in DBML transfer as formal FOREIGN KEY constraints with referenced columns.
- Unique constraints: UNIQUE column declarations and multi-column indexes remain intact.
- Documentation notes: Inline DBML table and column notes export as SQL COMMENT statements and populate entity descriptions in the modelling tool.
Because the DDL file contains explicit table constraints, the importer automatically draws foreign key connector lines between tables on the visual canvas upon import.
What Breaks: Layouts, Colors, and Table Groups
SQL DDL scripts only define relational data structures. Presentation metadata specific to the dbdiagram.io web canvas does not exist in standard SQL standards and will not transfer during export.
- Canvas coordinates: X and Y coordinates of tables on the canvas are lost.
- Header colors: Custom table header color tags (such as headerColor: #3498db) are not exported to SQL.
- TableGroups: Collapsible DBML table groupings are dropped by the SQL exporter.
- Sticky notes: Text notes and freeform annotations placed outside table definitions do not appear in DDL scripts.
- Online workspace settings: Web-based sharing links, team permission levels, and version history stay within the source platform.
An automatic layout algorithm arranges the tables when the SQL script is parsed, so you can reorganize them immediately after loading the schema.
Importing the SQL DDL Script into a Desktop Modeller
Importing your exported DDL script creates a structured design model without requiring a live database connection.
Launch the modeller on your local machine and proceed with the local file path to import SQL DDL.
- Select Import from SQL File on the welcome screen's Start New tab, or navigate to Model > Import from External Format from the top menu.
- Choose the SQL dialect matching the export format you selected in dbdiagram.io.
- Point the File field at your local .sql file with Choose, pick the matching DBMS, then click Next to run the DDL parser.
- Review the generated visual entities on the central design canvas.
The import produces a local .dbs design model file that encapsulates your entire schema structure.
This file uses a clean XML structure that you can commit directly to your Git repository. You can modify table architectures, define indexes, and add virtual relations in offline design mode without affecting any running database.
Rebuilding Diagrams in the Offline Model File
DBML is an established, open-source language for defining and documenting schemas. However, large schemas containing dozens of tables often become difficult to navigate within a single monolithic canvas.
A desktop modeller resolves canvas clutter by allowing you to split a single schema across multiple layout diagrams inside the same project file. Each sub-diagram focuses on a dedicated business context or microservice module.
- Create dedicated diagrams: Use Diagram > New Diagram (⌘L), or right-click a table and choose New Diagram, to isolate billing, authentication, or inventory domains.
- Add existing tables: Drag tables from the left schema tree into specific diagram views without duplicating database objects.
- Customize detail levels: Toggle column types, comments, or index visibility per diagram view to suit different audiences.
- Color-code entities: Assign custom colors to related table groups to replace lost DBML TableGroups visual organization.
All diagram layouts, table positions, and visual groupings are saved inside the single .dbs XML file. When you reopen your project, your visual layout remains exactly as configured.
Synchronizing the Schema with a Live Database
The final stage transitions your offline schema into a deployed database instance. The modelling tool connects directly to your target server to deploy new tables or compare differences against existing databases.
Open the connection dialog and select your database engine. DbSchema ships a bundled JDBC driver jar for each engine — the JDBC Drivers Manager shows which one is in use and lets you swap in your own — so the connection is established without sourcing a driver yourself.
Run the schema synchronization tool to compare your design model against the target database catalog. The comparison engine displays structural differences in a side-by-side visual diff tree, highlighting missing tables, altered columns, and modified constraints.
- Review diffs: Inspect individual column and table discrepancies between the model file and the live database.
- Select direction: Choose whether to apply model changes to the database or pull live database changes into the local model.
- Generate migration scripts: Review the generated DDL statements before executing them against development, staging, or production environments.
Executing the synchronization completes your schema migration workflow safely.
Frequently asked questions
How to export schema from dbdiagram.io?
You can export your schema from the top menu by selecting the export option to generate SQL statements. It supports exporting to 4 dialects: PostgreSQL, MySQL, SQL Server, and Oracle. You then save this file locally.
Can I import DBML into DbSchema?
Not directly, because DBML is not parsed as a native format. You must first export your dbdiagram.io model as a standard SQL DDL script, which the modelling tool can then parse to build the visual design model.
Will dbdiagram.io table colors export to SQL?
No, visual settings like custom table header colors and collapsible table groups are specific to the DBML ecosystem and do not exist in standard SQL DDL. You will need to rebuild your visual layout after importing the tables.
How do I connect my exported schema to a live database?
Once the SQL DDL is imported, you can configure a JDBC connection to your target engine. Run the schema synchronization tool to compare your imported model against the live database and deploy any differences.
Does SQL export keep foreign key relationships?
Yes, the standard SQL export preserves all your core database logic, including tables, columns, data types, primary keys, and foreign key relationships. These will map correctly when imported into a new modeling tool.
Conclusion
To finish the move, download DbSchema and open your exported SQL DDL file to start designing offline. The Community Edition covers visual ER diagramming, SQL editing, and schema reverse-engineering at no cost, while schema synchronization, Git model file versioning, and interactive HTML5 documentation exports sit in the Pro Edition.
Sources
Open your dbdiagram.io export against a real database
DbSchema parses your SQL DDL export into a visual model you can edit offline and synchronize against a live database. The free Community Edition covers ER diagrams, SQL editing and schema reverse-engineering.