ER Diagram Designer (Diagram to SQL)
Visually design a database schema in the browser — add entities, columns, primary/foreign keys, and relationships — and generate clean CREATE TABLE DDL for PostgreSQL, MySQL, SQLite, and SQL Server. Topological creation-order output (handles circular FKs), per-dialect reserved-word auto-quoting, migration scripts by diffing two schema versions, DBML import/export, and round-trip with the SQL DDL to ER Diagram Generator (#267). 100% client-side, no signup.
About ER Diagram Designer (Diagram to SQL)
Visually design a database schema in the browser — add entities, columns, primary/foreign keys, and relationships — and generate clean CREATE TABLE DDL for PostgreSQL, MySQL, SQLite, and SQL Server. Topological creation-order output (handles circular FKs), per-dialect reserved-word auto-quoting, migration scripts by diffing two schema versions, DBML import/export, and round-trip with the SQL DDL to ER Diagram Generator (#267). 100% client-side, no signup. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does the ER Diagram Designer work?
Add entities (tables) with columns — name, type, nullable, default, primary key, unique. Connect columns with foreign-key relationships to model cardinality. The designer emits clean CREATE TABLE DDL for PostgreSQL, MySQL, SQLite, or SQL Server, with tables ordered by a topological sort of FK dependencies (circular FKs are detected and broken deterministically). Switch dialects instantly, share the schema via URL, and import DBML or a schema JSON from the companion SQL DDL to ER Diagram Generator (#267).
Can it generate migration scripts by diffing two schema versions?
Yes. Save the current schema as a baseline, then edit the working schema (add/remove tables, columns, FKs). The diff engine produces ALTER TABLE ADD COLUMN, DROP COLUMN, ADD CONSTRAINT, DROP CONSTRAINT, RENAME TABLE, and CREATE/DROP TABLE statements for the target dialect. Renames are heuristic — when in doubt the diff emits a DROP + CREATE pair rather than a destructive rename.
Which dialect-specific behaviors does the DDL generator handle?
Per-dialect identifier quoting (PostgreSQL double-quote, MySQL backtick, SQLite double-quote or backtick, SQL Server square bracket), reserved-word auto-quoting per dialect (a 200+ word list), per-dialect type canonicalization (SERIAL vs AUTOINCREMENT vs AUTO_INCREMENT vs IDENTITY(1,1)), per-dialect FK syntax, ON DELETE / ON UPDATE actions (CASCADE, SET NULL, RESTRICT, NO ACTION, SET DEFAULT), composite primary keys, composite foreign keys, named constraints, and CHECK constraints.
Does this round-trip with the SQL DDL to ER Diagram Generator (#267)?
Yes. Both tools share the same JSON schema model shape. In #267 you paste DDL and export the schema JSON; in #268 (this tool) you import that JSON to keep designing visually, then re-export DDL. You can also import DBML exported by dbdiagram.io. The round-trip is lossless for the common case (tables, columns, types, nullability, PKs, unique, FKs, indexes, defaults).
What extras does this designer offer versus drawDB / dbdiagram.io / Lucidchart?
(1) Four dialects (PostgreSQL, MySQL, SQLite, SQL Server) with one-click switching. (2) Topological creation-order output with circular-FK detection. (3) Per-dialect reserved-word auto-quoting (200+ words). (4) Migration script generation by diffing two schema versions. (5) DBML import and export. (6) Round-trip JSON schema model with the SQL DDL to ER Diagram Generator (#267). (7) ON DELETE / ON UPDATE FK actions. (8) Composite PK / composite FK. (9) Named constraints. (10) CHECK constraints. (11) Inline validation warnings (orphan FKs, missing PK, duplicate names, reserved words). (12) Three starter presets. (13) localStorage history (max 20). (14) Shareable URL with base64-encoded schema. (15) Copy / download .sql with auto-history. (16) 100% offline, no signup.
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.