Create a database diagram
Create a drawDB diagram, add tables and fields, define indexes and relationships, and export a database schema.
Open the online editor. To replace the currently loaded diagram, choose File → New, then select a blank diagram or template.




Choose a database
Select the database dialect that matches your target:
- Generic
- MySQL
- PostgreSQL
- SQLite
- MariaDB
- Microsoft SQL Server
- Oracle SQL (Beta)
Database-specific diagrams provide the dialect's native types and features. Generic diagrams use a portable type set and can be exported to multiple SQL dialects.

Add tables and fields
Add a table from the sidebar or toolbar, give it a name, and define its fields.

For each field, you can configure:
- Name and datatype
- Primary, unique, and not-null constraints
- Autoincrement where supported
- Default value and check constraint
- Comment
- Array dimensions in PostgreSQL
- Unsigned numeric types in MySQL and MariaDB
Composite primary keys
Mark multiple fields as primary to generate a composite primary key in SQL output.
Check constraints
Check expressions are inserted into generated SQL as written. Use syntax supported by the target database.
Indexes and unique constraints
Indexes can contain one or more fields and can be named or unique. Tables can also define named, multi-field unique constraints. PostgreSQL diagrams additionally support table inheritance.
Create relationships
Drag from the blue connection point on the foreign-key field to the referenced field. The field types must be compatible. drawDB infers relationship cardinality from primary and unique constraints, and you can adjust it afterward.

In the example, posts.user_id references users.id. Open the Relationships tab to change the relationship name, swap its foreign and primary sides, configure one or more field pairs, and set labels for the many side.
Both ON DELETE and ON UPDATE support:
- No action
- Restrict
- Cascade
- Set null
- Set default
Use a join table containing foreign keys to the two related tables. The join table can also store relationship-specific fields.


Organize the canvas
Subject areas
Add subject areas from the sidebar or toolbar to visually group related tables. Subject areas improve navigation but do not generate SQL.
Notes
Use notes to capture requirements, decisions, or reminders directly on the diagram.
Custom types and enums
PostgreSQL and Generic diagrams expose a Types tab for diagram-defined composite types. PostgreSQL diagrams also expose an Enums tab. After creating a type or enum, it becomes available when selecting a field datatype.
The Settings menu also lets you configure local custom datatype aliases. These aliases are saved in the browser and are distinct from diagram-defined composite types.