Change a schema
Ask the assistant to change, review or explain an ER diagram, and see what it does with your diagram.
Once a schema has tables, you can ask the assistant to change it, review it or explain it. This page covers how it works on an existing ER diagram.
Ask for a change
Point at what should change and say how:
- "Add a categories table, with products in several categories."
- "Make email unique on customers."
- "Orders can have several shipments."
- "Add soft delete to posts."
For small changes, the assistant edits only what you asked about, plus what the change needs to stay correct. That could be a junction table's keys or a foreign key's type. The rest keeps its ids, and your comments stay on their elements. To have most of a schema redone, say so.
To point at particular elements, select them on the canvas before you send, or type @ and pick them from the list. The list shows each table followed by its columns, then enums and groups.
Use a command
Type / at the start of the message box to pick a command. Each one fills in a request for you to read over and send.
| Command | What it asks for |
|---|---|
/review | Review the schema: missing keys and constraints, relationships that should be junction tables, naming and types, and fix what's plainly wrong |
/fix | Fix the issues the checks found |
/explain | Explain in plain words, for a new team member: what each table holds and how they relate |
/indexes | Add the indexes the schema needs for the queries it will obviously serve, and say why each helps |
/draft | Design a schema you describe |
On a diagram that already has tables, the starting points above the message box are Review this schema and Explain it. When the checks found issues, there's a fix for them too. When the schema has no indexes yet, apart from keys, there's Suggest indexes.
What it does with your diagram
- Drafting or redoing most of it: it writes the whole schema as schema code and replaces the diagram with it.
- Smaller changes: it applies a batch of small edits to tables, columns, relationships, enums, groups and indexes. If one edit in a batch fails, none apply.
- Checking its work: after every change it gets the checks back, and fixes errors and real problems before it finishes.
The change card lists what was added, changed and removed, such as a column that's now required or a table that was renamed. It ends with a short summary of what it modeled or changed, what it assumed, and one or two things you might add next.
Your team's context
The business context, the Model and your learnings work here as they do for a process. The assistant reads the learnings meant for every diagram and those for ER diagrams.
Tables are matched to the Model's data. When the assistant adds a table whose name isn't in the Model, the app tells it so. It also gives the nearest name the Model has, when one is close, so the assistant can switch to your team's name. See How context works.