A schema imported from a real database rarely arrives in a readable shape. Two hundred tables in a grid tells you nothing about which ones belong together. Two changes this week help with that.
Organise with AI
Open the overflow menu and choose "Organise with AI". The assistant reads an outline of the diagram (table names, column names and which tables link to which) and names a group for every table: billing, identity, catalogue, whatever the schema suggests. The editor then writes the groups and lays out the canvas, with each group's tables placed by how they link.
It's one undo step. If you don't like the result, undo puts every table back where it was.
Because the assistant only sees names and links, large schemas fit, and none of your data goes anywhere. It costs one AI request from your monthly allowance, and it needs a Pro, Team or Enterprise plan.
After any import of more than one table, the success message offers it, and a merge into the open branch can organise only the tables it added, leaving everything else where you put it.
Where to find it
- The More actions menu (the three dots at the right of the editor's top bar) has an Arrange tables section: Left to right, Top to bottom and Organise with AI.
- The command palette (
⌘K, orCtrl Kon Windows and Linux) lists Organise with AI too, as "Group tables by domain, then arrange". - After an import, the toast that says how many tables came in has an Organise with AI (1 request) button.
You need edit access to the branch, and at least two tables on it.
What the assistant sees
Say you've imported nine tables from a SaaS app's database. They land in a grid in the order they came in. Organise with AI sends the model this, and nothing more:
Tables (with their columns):
users: id, email, name, created_at
sessions: id, user_id, expires_at
workspaces: id, name, slug
memberships: id, workspace_id, user_id, role
products: id, name, active
prices: id, product_id, amount, currency
subscriptions: id, workspace_id, price_id, status
invoices: id, subscription_id, total, paid_at
audit_log: id, actor_id, action, created_at
References:
sessions -> users
memberships -> workspaces
memberships -> users
prices -> products
subscriptions -> workspaces
subscriptions -> prices
invoices -> subscriptions
audit_log -> users
Current groups: (none)
No types, no constraints, no policies, no rows. That's why a schema with hundreds of tables still fits in one request: the outline only has to stay under 120,000 characters. Past that, the app asks you to try a smaller schema tab, and only the tables on the tab you're viewing are sent.
The model is asked for 2 to 8 groups, each with at least two tables where it can, named with short Title Case nouns. For the outline above it might answer with groups such as Identity (users, sessions), Workspaces (workspaces, memberships) and Billing (products, prices, subscriptions, invoices). A table that fits nowhere, like audit_log perhaps, can be left out, and it ends up ungrouped.
If some tables already have groups, the model is told what they are and asked to keep the names that make sense. Rename a group to "Accounts" and run it again, and that name is in front of the model as one to keep.
What the editor does with the answer
The reply is only group names and table names. The editor checks it against the tables it has before writing anything:
- Names are matched case-insensitively, including a
schema.prefix where a table has one. - A table name the model made up is skipped, with a note such as "Skipped “carts” in Billing: there is no such table."
- A table named in two groups stays in the first one.
Then it writes the groups and arranges the canvas, left to right, in two passes. Each group's tables are laid out with the links between them, then the groups themselves are laid out as blocks, with the links between groups deciding which sit next to each other. A group that would come out as a long strip is placed by its links instead, hub table first, so you don't end up scrolling sideways to read it.
The toast says how many groups you got ("Organised into 3 groups") and reminds you that undo puts everything back. Groups and positions are all that change. Your tables, columns and relationships are exactly as they were.
To adjust a group afterwards, click its label on the canvas. You can rename it, change its colour or ungroup it, and each of those is its own undo step. Dragging the label moves the whole group.
Organising only what a merge adds
When you merge a branch into the one you have open, the Merge and review window has a checkbox at the bottom: Organise new tables with AI. Tick it and the request names the tables the merge adds. The model is told that only those move. Once the merge lands, each new table goes into the existing group it fits best, or a new group with the other new tables it belongs with.
Placement follows the same idea. New tables are fitted in beside the rest of their group, or near the tables they reference, or to the right of everything if neither applies. Nothing already on the canvas moves, and new tables never land on top of a table or a group box.
This also costs one request. The checkbox only appears when the merge adds tables to the branch you have open, and only where Organise with AI itself is offered.
Describe your schema from the start card
An empty branch now opens on a start card: add a table, import a schema, or describe what you're building to the assistant. The description gets the same treatment as any assistant proposal. You see the tables and columns it suggests, as changes to review, before anything is added.
Choose Ask AI on the card and the Describe your schema step opens with a box and a few examples to start from, such as "A shop with products, variants, carts and orders". Press Enter to send, or Shift+Enter for a new line. While the assistant works, you can keep going; its reply also lands in the assistant tab. If it needs more to go on, it asks, and Reply in chat takes you there.
Columns on every new table
Diagram settings has a new option: columns added to every new table. If every table in your schema has id, created_at and updated_at, set them once and stop typing them.
It lives under New tables in Diagram settings. Add an id primary key is the first row, with the id's type beside it. Below it, Extra columns are added to every new table, after the id key. Each one has a name, a type, a Nullable box and an optional default. There are presets for created_at and updated_at (not null, defaulting to CURRENT_TIMESTAMP) and a nullable deleted_at for soft deletes, typed for the diagram's engine: timestamptz on PostgreSQL.
The setting applies to tables added from now on. Tables already on the canvas keep the columns they have. A column name used twice, or a column called id while the id key is on, is refused when you save.
Limits
- Outside a free trial, each member of a paid workspace gets a monthly allowance of AI requests: 100 on Pro, 200 on Team and 500 on Enterprise. Organise with AI and a merge that organises its new tables each use one.
- The assistant decides the groups, so two runs on the same schema can differ. Undo is always one step back to where you were.
- Arrange tables (left to right or top to bottom) uses the same layout without the AI step, and costs nothing. It keeps the groups you already have.