Import SQL (DDL)

Already have a database? Dump its schema, paste it into DrawSQL, and get a full diagram — tables, columns, primary keys, indexes, comments, and every foreign key drawn as a relationship. Works with MySQL, PostgreSQL, and SQL Server, including hosted flavors like Supabase, Neon, RDS, PlanetScale, and Azure SQL.

Get your schema dump

You want a structure-only dump — CREATE TABLE statements, no data. Here's the exact command or menu for each DBMS.

MySQL / MariaDB

 mysqldump --no-data --skip-comments -u USERNAME -p DATABASE > schema.sql

Just need one table? Run SHOW CREATE TABLE table_name; and paste the output. From a GUI: MySQL Workbench (Server → Data Export, tick Skip table data), phpMyAdmin (Export → Custom → Structure only), or TablePlus/DBeaver's structure-only SQL dump.

PostgreSQL

 pg_dump --schema-only --no-owner --no-privileges DATABASE > schema.sql

For a hosted database, pass the connection string instead of a database name:

 pg_dump "postgresql://user:password@host:5432/dbname" --schema-only > schema.sql

From a GUI: pgAdmin (right-click the database → Backup…, Format: Plain, then Only schema under Data/Objects), or TablePlus/DBeaver's structure-only dump.

SQL Server

In SQL Server Management Studio, right-click your database → Tasks → Generate Scripts. Select your tables, and under Advanced set Types of data to script to Schema only.

SQL Server statements must be delimited with a semicolon. If your tool separates statements another way, add semicolons before importing.

No live database? Generate SQL from your ORM

  • Laravel: php artisan schema:dump writes a SQL schema file to database/schema/.

  • Prisma: npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script prints the full CREATE TABLE script.

  • Rails: if your app uses db/structure.sql, import it directly. If it uses schema.rb, use the Rails import instead.

Import it

Import menu
  1. In the diagram editor, click FileImport.

  2. Paste the SQL, upload the .sql file, or fetch it from a public GitHub repo.

  3. (Optional) If a table in the import already exists on your canvas, choose whether to keep both or override the existing one.

  4. Click Begin Import, then review the log to see if anything needs manual attention.

Import complete

What gets imported

  • Tables and columns, with data types, nullability, and defaults

  • Primary keys, unique constraints, and indexes

  • Foreign keys — drawn as relationships between tables

  • Table and column comments (MySQL and PostgreSQL)

  • Enum columns, with their values

Statements that aren't schema structure — views, triggers, stored procedures, INSERTs — are skipped and noted in the import log. They don't fail the import on their own, but they do count toward the parser's size limit, so a dump heavy with data rows or routines can exceed it and fail outright. Exporting schema-only, as above, avoids that.

Still have a question? We'd love to help!