Edit on the canvas

What's different about editing an ER diagram on the canvas, and where to find each task.

This page covers what's specific to editing an ER diagram on the canvas. Moving around, selecting, renaming, colour, comments and undo work the same in every kind. See Edit on the canvas and Move around.

How the layout works

The app lays out every ER diagram for you. It places the tables, keeps each group's tables together, and puts the enums and notes below. It routes each line so it ends on its column's row.

You change what's there, and the layout follows. To put a table somewhere else, drag it there and it stays. See Move and arrange.

Each task has its own page:

Select

Selecting works as in every kind. See Select. On an ER diagram, what a click picks depends on where you click:

  • A table's header selects the table. One of its rows selects that column.
  • A line selects the relationship.
  • An enum, a note or a group's frame selects it.

⌘ A (Ctrl A on Windows and Linux) selects every table, relationship, enum, note and group. Dragging across empty canvas selects the tables, enums and notes the box touches, and the groups it covers completely.

Selecting a table or a column darkens its lines and tints the columns at their other ends. That shows what it's connected to. Selecting an enum tints the columns that use it. To follow the connections further, through every table that depends on it, use Trace (⇧ T).

The arrow keys move the selection. ↑ and ↓ go through each table and its columns in reading order, then the enums, notes and groups. ← and → go from table to table.

The selection bar

When you select an element, a bar of tools floats above it. What it starts with depends on the element:

SelectedTools
TableRename, Group table (or Move to group once the diagram has groups), Add column, Colour, Add note
ColumnChange type (shown as the column's type), Rename, Key, Required, Add note
RelationshipCardinality, Add name (or Rename), Flip direction, Colour
EnumRename, Add value, Colour
GroupRename, Add table, Colour, Add note
NoteEdit text, Colour

Every element also has Ask assistant and Comment. The bar ends with More (⋯), which lists everything you can do with the element. See Select for how the bar and More work.

More also holds the rarer tools:

  • For a column: Unique, Index, Move up, Move down and Add column below.
  • For a table: Add table.
  • For every element: Properties, and last, Delete. For a group it's Ungroup, which removes the frame and keeps its tables.

Change type offers common types such as integer, text and timestamp, then your enums, then Edit type… to write any type.

Key and Required are on or off, shown by the button's pressed look. Required is off for a key column, which always needs a value.

Cardinality picks Many to one, One to one or Many to many. For the first two, the same menu sets the reference to Required or Optional. Flip direction swaps which side of a relationship holds the reference.

With several elements selected, the bar offers Make key for columns of one table, and Group tables (or Move to group) when the selection has a table. It also offers Colour, Ask assistant and Comment.

Rename

Rename tables, columns, enums, groups and relationships in place, as in every kind. See Rename and style text.

Relationships point at columns, not names. So renaming a table or a column changes nothing else.

A relationship's name is drawn beside the middle of its line, such as the "places" a Mermaid file gives it. The name is also the foreign key's name in SQL.

Double-click the name to change it. For a relationship with no name, double-click its line or choose Add name in its bar. Empty the name to take it off the line.

You can also write a column's type and an enum's values in place. Double-click the type at the end of a row, or a value. Everything else is edited in Properties.

Delete

Select elements and press ⌫ (Backspace) or Delete. A few rules apply:

  • Deleting a table or a column also deletes its relationships.
  • A table needs at least one column. To remove the last one, delete the table.
  • Deleting an enum turns the columns of its type into varchar.

Read a schema

These work in every kind. In an ER diagram:

  • Trace downstream from a table shows every table that depends on it: what you'd have to change if you changed it. From a column, it shows the columns it feeds.
  • Select two tables and turn Trace on to see how they join. Copy JOIN copies the query. See Paths between two elements.
  • Detail levels show the keys alone, or each table's name alone.
  • A column that looks like a key but isn't related has Relate in the Problems panel. See Checks.
  • Compare with now shows what changed since a version, and Copy migration SQL copies the script that makes the change in a database.
  • Any element can link to another diagram, such as a table to the process that fills it.

An ER diagram has no order to walk, so it has no Walk through.

Comment, ask and undo

These work as in every kind:

  • Press M to comment on the selection. See Comments.
  • Press ⌘ L to ask the assistant about the selection. It takes "this" or "these" to mean what you selected.
  • Press ⌘ Z to undo. See Undo and redo.

On this page