Drawtabase — database schema designer
Design a relational database schema visually, in sync with your SQL file. Tables sit on a canvas with
their columns, foreign keys are drawn from column to column, and the CREATE TABLE statements are
kept up to date. Edit the diagram and the SQL changes; edit the SQL and the diagram changes.
This is the Drawtabase web editor, running inside VS Code on the
files in your workspace.
Use it
- Open a SQL file with your
CREATE TABLE statements (.sql or .ddl).
- Click the Open Diagram Editor to the Side button in the editor's title bar, or run
Drawtabase: Open Diagram Editor from the Command Palette. You can also right-click the file in
the Explorer.
- Edit on either side. The text editor and the diagram follow each other as you type.
The file stays an ordinary SQL file. Save, undo, revert and source control all work the way they do
for any other file: Ctrl+S saves it and Ctrl+Z undoes the last change, whichever side made it.
To open schema files with Drawtabase by default, add this to your settings:
"workbench.editorAssociations": { "*.schema.sql": "drawtabase.editor" }
What you can do
- Add, rename and delete tables; add, reorder and edit columns (type, primary key, NOT NULL, UNIQUE,
DEFAULT).
- Draw foreign keys from column to column, with ON DELETE and ON UPDATE actions.
- Arrange the tables yourself, or let auto layout do it.
- Export the diagram as SVG, PNG or PDF.
Good to know
- Moving tables never changes your file. Where the tables sit is remembered for each file on this
computer, in VS Code's storage for the extension. It is not written into the SQL and is not shared
through source control. Moving a table cannot be undone with Ctrl+Z.
- A diagram edit rewrites the file in Drawtabase's own formatting. SQL comments are not kept, and
neither is anything the diagram does not show: indexes, CHECK constraints, named constraints,
statements other than
CREATE TABLE and foreign keys. Drawtabase asks before it rewrites a file it
did not write, once per file, and lists what would be lost. Edits you type in the text editor are
never reformatted.
- The SQL is a generic dialect. Vendor-specific syntax may be reported as unsupported.
- A file with a syntax error, or with statements but no
CREATE TABLE, is not opened as a diagram and
is left untouched. Fix it in the text editor and the diagram appears by itself.
- A new, empty file opens as an empty schema. Nothing is written until your first edit.
Privacy
Drawtabase runs entirely inside VS Code. It makes no network requests, has no telemetry, and reads and
writes only the file you open with it, plus the remembered layout described above. The editor's page
is not allowed to contact any server.
Privacy policy · Terms of service
Feedback
drawdiags.com/contact
Part of the Free Diagrams suite: Drawmaid (Mermaid), Drawuml (PlantUML),
Drawtabase (SQL), Drawpenapi (OpenAPI) and Drawlize (JSON and YAML).