Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Database Schema Designer

Draw tables or write DBML, then get SQL for five databases, Prisma and a data dictionary.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Developer

Free preview: the whole diagram and every check of your design, with the first lines of each export (up to 20). Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: the whole diagram and every check of your design, with the first lines of each export (up to 20).
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment that never renews. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

100%

Tab moves from table to table. Arrow keys move the focused table (Shift for bigger steps) and Enter opens it in the editor. On the empty canvas, arrow keys pan; plus and minus zoom; 0 fits the design.

Checks and exports

    Next steps Done. What next?

    Start over

    A Pro pass unlocks the full result. See passes

    All developer tools

    About the Database Schema Designer

    Plan an app’s database before you write a migration. Add tables on the canvas, give each column a type, a default and its flags (primary key, not null, unique, counting up by itself), and link tables: many to one becomes a foreign key, one to one a unique foreign key, many to many a join table with a key to each side. Or write the design as DBML or a short shorthand and watch the diagram follow as you type, or import the CREATE TABLE statements of a database you already have (PostgreSQL, MySQL or MariaDB, SQLite, SQL Server).

    The diagram uses crow’s-foot ends: a ring for “zero”, a bar for “one”, a fork for “many”, a solid line when the key is part of the child’s primary key. Checks run on every change: tables without a primary key, foreign keys without an index, keys whose type differs from what they point at, names that are reserved words in PostgreSQL, MySQL, SQL Server, SQLite or Oracle, names too long for a database, and naming that mixes styles.

    The design exports as CREATE TABLE scripts for PostgreSQL, MySQL, SQLite, SQL Server and Oracle, a Prisma schema, DBML, the shorthand, a Mermaid erDiagram, JSON Schema, a data dictionary (Markdown, one HTML file or PDF) and the diagram as SVG or PNG. Everything runs in your browser, and the design is kept in this browser and in a file you save. Without a pass the diagram and the checks are complete and each export is a free preview of its first lines; downloading and copying the exports unlock with a Pro pass.

    How to use it

    1. Start from a template (users and roles, shop orders, bookings, CRM, blog), a blank design, a file, or your own SQL under Import SQL.
    2. Add tables with Table, then pick a table (click it on the canvas or choose it under Table to edit) to name it and edit its columns, indexes and note.
    3. Under Relationships, choose the kind, the table that holds the key and the table it points to; leave “A new column” to have the key column made for you.
    4. Prefer typing? Switch to DBML or Shorthand: the diagram follows the text, and each problem is listed with its line.
    5. Read Checks, fix what they point at, then open Export and choose the format. With a pass, or once this design is unlocked, download or copy it; the free preview shows the first lines.

    Examples

    A relationship in DBML
    Input
    Ref: orders.customer_id > customers.id [delete: cascade]
    Result
    ALTER TABLE orders ADD CONSTRAINT orders_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customers (id) ON DELETE CASCADE;

    > is many to one (orders holds the key), - one to one (the key is also unique), <> many to many (a join table orders_customers is made).

    One column, five dialects
    Input
    id bigserial [pk]
    Result
    PostgreSQL BIGINT GENERATED BY DEFAULT AS IDENTITY · MySQL BIGINT AUTO_INCREMENT · SQLite INTEGER PRIMARY KEY AUTOINCREMENT · SQL Server BIGINT IDENTITY(1,1) · Oracle NUMBER(19) GENERATED BY DEFAULT AS IDENTITY
    The same table in the shorthand
    Input
    orders
    -
    id PK bigint AUTOINCREMENT
    customer_id bigint FK >- customers.id
    note text NULL # what the customer wrote
    Result
    Table orders with a primary key, a foreign key to customers and a nullable note

    What each SQL script contains

    • PostgreSQL: CREATE TYPE … AS ENUM for enums, identity columns, named primary, unique and foreign keys, COMMENT ON for notes.
    • MySQL: InnoDB tables in utf8mb4 (so foreign keys are enforced), ENUM(…) columns, AUTO_INCREMENT, COMMENT clauses; MySQL has no time-zone timestamp, so timestamptz becomes DATETIME (store UTC).
    • SQLite: foreign keys inside CREATE TABLE (SQLite cannot add one later) and a reminder that SQLite checks them only after PRAGMA foreign_keys = ON; enums and booleans become text and integers with a CHECK.
    • SQL Server: IDENTITY(1,1), NVARCHAR for text, named defaults, and notes as MS_Description extended properties.
    • Oracle: identity columns, VARCHAR2(n CHAR), NUMBER for integers and booleans with a CHECK, COMMENT ON for notes.

    Every script creates the tables first and adds the foreign keys afterwards (except SQLite), so tables that point at each other work in any order. A name is quoted only where that dialect needs it: a reserved word, a space, or capitals in PostgreSQL. What a dialect cannot hold (an index on an expression or a cascade on a key to the same table in SQL Server, ON UPDATE in Oracle) is listed under the script, and MySQL gets the defaults of TEXT and JSON columns in the parentheses it requires.

    Prisma schema

    The Prisma export is a schema.prisma for Prisma ORM 7: the prisma-client generator with its output folder, and a datasource that names only the provider, because Prisma ORM 7 keeps the connection URL in prisma.config.ts (Prisma’s upgrade guide). Each table becomes a model with @@map to its name, each column a camelCase field with @map, keys become @id, @@id, @unique and @@index, defaults become autoincrement(), now(), uuid() or dbgenerated(), and every relation has its @relation(fields, references, onDelete) side and its list (or optional) side. Choose PostgreSQL, MySQL, SQLite or SQL Server for the provider: native types such as @db.VarChar(255) and @db.Uuid follow it, and what that database lacks in Prisma (Json fields and enums on SQL Server) is written as String and listed. Json fields and enums on SQLite are kept: Prisma supports both there and checks the enum values itself (Prisma schema reference).

    DBML and the shorthand

    The DBML reader follows the DBML documentation: Project, Table (schema names, as aliases, notes), column settings (pk, not null, unique, increment, default, note, inline ref), indexes and checks blocks, Ref in its short and long forms with delete and update actions, Enum, TableGroup and TablePartial. Sample records and sticky notes are skipped, and say so.

    The shorthand is a compact text in the style of QuickDBD: a table’s name, a line of dashes, then one column per line as name type with PK, NULL, UNIQUE, INDEX, AUTOINCREMENT, DEFAULT value or FK >- table.column after it (- for one to one, >-< for many to many, -< when the other column holds the key). Columns are NOT NULL unless they say NULL, and text after # is a note.

    Reserved words and name lengths

    Names are checked against each vendor’s own list: the reserved key words of PostgreSQL, the reserved words of MySQL, SQL Server and Oracle, and the keywords of SQLite. A name such as order, user or desc then needs quotes in every query, so the check names a plain alternative. Lengths: PostgreSQL cuts a name longer than 63 bytes, MySQL allows 64 characters, SQL Server 128 characters and Oracle 128 bytes; the check counts characters, so names in other scripts than Latin reach the byte limits sooner.

    Limitations

    • A design describes tables, keys, indexes, enums and notes. Views, triggers, functions, partitions and permissions are not part of it, and the SQL import skips them (and counts them).
    • Types are mapped between dialects for the common types (integers, decimals, text, dates and times, UUID, JSON, binary); any other type, such as a PostGIS geometry, is written as it is in every dialect and noted by the checks.
    • Positions on the canvas are kept in this browser and in the saved file; DBML and SQL have no place for them, so a design read from text is arranged again.
    • The shorthand is this tool’s own compact syntax in the style of QuickDBD, not a copy of any other tool’s grammar: check the rules above before you paste text from elsewhere.

    Privacy

    On this device: nothing is sent

    Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

    Frequently asked questions

    What do I get without a pass?

    Without a pass, Database Schema Designer shows the whole diagram and every check of your design, with the first lines of each export (up to 20). Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

    Which databases can it write SQL for?

    PostgreSQL, MySQL (also MariaDB), SQLite, SQL Server and Oracle. Each script uses that database’s own types, identity columns and comment syntax, and lists anything that could not be carried over.

    Can I start from my existing database?

    Yes. Dump its schema (for example pg_dump --schema-only, mysqldump --no-data or sqlite3 app.db .schema), paste the result under Import SQL and press Import. The diagram is arranged by itself; move tables wherever you like. The SQL to ER Diagram tool reads the same SQL when you only need the picture.

    Why does it warn about foreign keys without an index?

    PostgreSQL, SQL Server, Oracle and SQLite do not index a foreign key by themselves, so deleting a parent row, or joining from the parent, reads the whole child table. MySQL’s InnoDB adds such an index when there is none. Adding the index the check names avoids slow deletes and joins.

    How is many to many stored?

    As a join table with a foreign key to each side and a primary key over both columns, which is how every relational database stores it. The designer makes that table for you (posts_tags for posts and tags) and you can add columns to it, such as when the link was made.

    Is my design uploaded?

    No. Drawing, checking and every export happen in your browser. The design is kept in this browser’s storage so it is there when you come back, and Save file writes it to a file you keep.

    Quick answers and tool search

    Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.