Schema Modelling
Requires Premium
The table designer and ER diagram are Premium features.
Table designer
Right-click a table → Design… to open the designer:
- Rename the table.
- Add, rename, retype and drop columns, toggling nullability.
- Edited/new/dropped rows are highlighted.
- Preview shows the exact
ALTER TABLEstatements that will run. - Apply runs them in order.
ALTER TABLE `elyra`.`customers` RENAME COLUMN `country` TO `country_code`;
ALTER TABLE `elyra`.`customers` MODIFY COLUMN `name` VARCHAR(120) NOT NULL;
ALTER TABLE `elyra`.`customers` ADD COLUMN `vip` INT NULL;
Note
DDL statements auto-commit and are applied sequentially; if one fails, the error reports how many statements had already been applied.
ER diagram
Open ER diagram from the command palette (⌘/Ctrl + K) to see the current database as a diagram.
What it shows
- One box per table with every column, its type, and what it is: PK primary key, FK foreign key, UQ unique, and a trailing ? on a column that allows NULL. Views are not drawn.
- Relationships from column to column — from the column holding the reference to the key it points at, because which column holds it is usually what you came to find out.
- Crow's-foot ends, read from what the schema actually states. A nullable
reference makes the parent optional (
|o); a NOT NULL one makes it required (||). A referencing column that is unique makes the relationship one-to-one; otherwise it is one-to-many. "One or many" on the child side is never drawn: no schema says a parent must have children, and the diagram does not claim rules the database does not enforce.
Relationships nobody declared
Many real schemas have no foreign keys at all — ClickHouse has none by design, and plenty of MySQL applications never declared theirs. A diagram of only the declared keys would then be a page of boxes with no lines.
So the diagram also infers relationships from naming: user_id pointing at
users.id, category_id at categories.id, and parent_id as a reference to
its own table. It is deliberately cautious — it only proposes a line when the
name matches a table that exists, that table has a single key column, and the
two columns are the same kind of type — and would rather miss owner_id → users than invent a link that is not there.
An inferred relationship is never presented as a declared one. It is drawn dashed and dimmer, its column is marked fk? instead of FK, every export labels it as inferred, and the inferred switch in the toolbar hides them all. A foreign key is a constraint the server enforces; a name is a guess.
Layout
- Arrange lays the diagram out automatically, with tables that are referred
to placed first —
usersbeforeordersbeforeorder_items. Choose left-to-right (→) or top-to-bottom (↓), and compact, comfortable or spacious. Tables with no relationships are packed into a grid underneath. - Drag a table to place it yourself. Positions are remembered per connection and database, so an arrangement you made is still there next time. Arrange discards them and starts again.
- Zoom with the scroll wheel (around the pointer) or the ± buttons, pan by dragging the background, Fit to bring everything into view.
- Find table dims everything that does not match. Click a table to highlight it and its direct neighbours; double-click it to open it in the grid.
From pasted SQL
ER diagram from SQL… in the command palette draws a diagram with no connection at all — for a schema you are designing, or one you were handed as a file.
Paste CREATE TABLE statements, or press Open .sql…, and Draw (⌘/Ctrl
- Enter). The same diagram opens: layout, cardinality, inferred relationships and every export work exactly as they do for a live database.
- The SQL is read on this machine and sent nowhere — not to a server, not to a model.
- Dialect: leave it on Detect automatically, or choose MySQL / MariaDB / ElyraSQL, PostgreSQL, SQLite, ClickHouse, SQL Server, Oracle, Snowflake, BigQuery or generic SQL.
- What is read:
CREATE TABLE(columns, types,NOT NULL,PRIMARY KEY,UNIQUE, inlineREFERENCESand table-levelFOREIGN KEY),ALTER TABLE … ADD CONSTRAINT/ADD COLUMN, andCREATE UNIQUE INDEXon one column. Everything else in a dump —SET,DROP,INSERT, comments — is passed over. - A statement that cannot be read is skipped, not fatal. A real dump mixes in vendor syntax no single dialect accepts; the rest of the tables are still drawn, and the panel says how many statements were skipped and why.
- A dump with its data is usually too large (the limit is 8 MB). Export the
schema only — for MySQL,
mysqldump --no-data— and paste that. - Edit the SQL and Draw again: tables still there keep their position, and new ones are laid out. The arrangement lasts while the tab is open; a pasted diagram has no connection to save it under.
Export
Export ▾ writes the whole diagram — not just what is on screen — to your Downloads folder:
| Format | For |
|---|---|
| PNG | Documents, slides, chat |
| SVG | Anything that scales; opens in any browser |
| Mermaid | Markdown that renders on GitHub, GitLab and most wikis |
| DBML | dbdiagram.io and dbdocs |
| PlantUML | Documentation pipelines that already use it |
The image exports use the colours of your current theme.