Skip to content

Using the Viewer ​

Each card is a table, and each line a relationship between two of them. A note icon marks a table or a column that has a comment or a note: hover it to read them, or turn on Notes under Show (N) to write each table's and column's note on its card, on a row of its own. The same icon on a line's label marks a relationship with a note; hover the label to read it. Referenced tables sit to the left of the tables that point at them. Drag cards to arrange them; Shift+click several tables, or drag a box around them on the background, to select them and move them together (Esc clears the selection, and Details lists them). Scroll, sideways too, to move around, or drag with the hand or Space held; hold Ctrl, ⌘ or the Windows key while scrolling, or pinch, to zoom. At 40% and below, the diagram shows a picture of itself with each column as a placeholder bar, the way dbdiagram does: it moves smoothly however many tables there are, the picked table and its lines stay live and readable on it, and a click or double-click on a table works as on its card. The ? button in the bar takes a one-minute tour.

Open the demo full screen →

The viewer shows the snapshot php artisan schema-viewer:build last wrote; it never reads the database or the models itself, so there is no button to read them again. After you migrate, alter a table by hand or change a model, run the build again and reload the page. See The schema snapshot.

The floating bar ​

The bar at the bottom of the diagram holds every view control:

ControlWhat it does
− / 100% / +Zoom out and in. Click the percentage to type a zoom from 2 to 200%.
FitFits the whole diagram on screen (F).
HandPan mode: drag anywhere, the background or a table, to move around; a click still picks a table, a column or a line. Or hold Space. Outside pan mode a drag on the background draws a selection box.
ArrangeArranges the tables automatically, three ways: Left-right, along the relationships with referenced tables to the left (the default); Snowflake, the most connected tables in the middle and the tables they join around them; Compact, a tight rectangle in name order.
RelationshipsShows or hides each kind of line, with its legend: FK + relation, relation only, FK only, through (1–4). The button says N off while kinds are hidden.
TablesShows or hides each kind of table, with its count: Your tables (Y), Framework tables (G) and Package tables (P).
ShowRelation names on every line, on by default (L), Notes written out on the cards (N), the Grid, and Columns: All, only the Keys and the columns relations use, or only the table Names (C). A card's own arrow folds just that card.
?Takes the tour.

When the diagram is narrow, as on a phone or beside a wide panel, the three menus show as icons.

Relation names show on every line by default. Large schemas stay readable: a connection with more than 40 tables is laid out in packed columns, and with more than 60 tables on screen the lines are thin and muted. Turn Relation names off to label only the picked table's lines.

The side panel ​

The panel on the right has four tabs:

  • Browse (A) lists every table with its models (Tables & Models), every Relationship or every Column, with one filter. Pick a row to show it on the diagram.

  • Details (D) shows what is picked, with Focus and Copy link at the top:

    • nothing yet: the project's note, when you set one;
    • a table: its comment and note, its columns with each one's comment and note, relations, the tables that use it, indexes and model. An index is marked partial, expression (a key part such as lower(email) or a prefix such as name(10)) or with its structure (fulltext, gin, hash…), and lists its INCLUDE columns;
    • a relationship: its note, its keys, its state (FK + relation, relation only or FK only), the foreign key's name, on update and on delete actions and index, and the relations that use it;
    • a column: its type, null, default, comment and note, casts, indexes, foreign keys in and out, and the relationships that use it.
  • Hints (H) lists where the database and the models disagree, and where the database itself could be better. A hint marked likely is inferred from names or conventions; All, Certain and Likely filter them. See Hints.

  • Changes (W) lists what the last build that found a difference changed; see Changes.

Drag the grip on the panel's edge to widen or narrow it; double-click it to reset. The diagram always keeps room for the bar. With an editor set, model and relation names open in it at their line.

Changes ​

Each schema-viewer:build compares the schema with the snapshot it replaces, and the Changes tab lists the difference, grouped by table: tables, columns, indexes and foreign keys added, removed or changed (with the old and new values), models and relations, and relationships that gained or lost their foreign key. Hints have their own tab and are not listed here. Click a row to open its table, column or relationship; removed rows are struck through. On the diagram, a filled dot marks a new table and a ring a changed one.

The tab follows the connections in view. Before a second build has found a different schema it says there is nothing to compare yet. A renamed table or column shows as one removed and one added. Only the last step is kept: a build that changes none of it keeps the list, even when only hints differ, and the next change replaces it. To see a longer stretch, compare with an older file using schema-viewer:diff.

Picking and focus ​

Click a table, a line or a column row on the diagram to pick it, and its details open. Picking a relationship or a column lights it up and dims the rest.

Double-click a table, a line or a column to focus on it: only it and the tables around it stay on the diagram. The bar at the top chooses 1, 2 or 3 links away; for a relationship or a column, 1 link keeps just the tables it touches. Shift F focuses on what is picked, or leaves focus mode. Esc leaves focus mode first, then clears the pick.

Saving the diagram ​

Download saves the diagram as an SVG or PNG image, as it is shown, the whole of it or what is on screen; see Diagram image.

Sharing a view ​

The viewer keeps what is on screen in the URL, so a link opens the same place:

HashOpens
#connection=mysqlA connection, or all for every one side by side
table=mysql:ordersA table
relationship=mysql:<link id>A relationship; the link id is in the JSON export's links
column=mysql:orders.user_idA column
focus=1Focus mode, 1 to 3 links away

Copy link in the details panel, next to Focus, copies a link to exactly this view (Shift C). It adds at=x,y,zoom and columns=keys or columns=none, so the link opens the same view, zoom included. Links work in an exported HTML file too. A link to something the schema no longer has opens the whole diagram and says so.

Keyboard shortcuts ​

S lists them in the viewer, and can show each key next to its control.

KeyAction
/, ⌘ KSearch tables, columns, models and relations
EscLeave focus mode, clear the pick, close a panel
FFit the diagram
+ −Zoom in or out
Ctrl / ⌘ + scroll, pinchZoom in or out at the pointer
ScrollMove the diagram up, down or sideways
SpaceHold to pan
Shift + clickAdd a table to the selection, or take it out
Drag on the backgroundSelect every table the box touches
1–4Show or hide each kind of line
Y G PShow or hide your own, framework or package tables
LRelation names on every line
NNotes on the cards
CAll columns, keys only, or names only
A D H WBrowse, Details, Hints or Changes
[ ]Previous or next connection
Shift FFocus on what is picked, or leave focus
Shift RRead the schema again (app only)
Shift CCopy a link to this view
?Take the tour

Light and dark ​

The viewer opens light. The switch in the top bar turns on dark mode, remembered in this browser; it is the only setting the viewer keeps there, and every other view setting starts fresh on each visit. The demos on this site follow the site's theme.

Phones ​

On a phone the viewer notes that the diagram is easier on a larger screen; every table and its details are still there. The panel becomes a bottom sheet: tap a table, a column or a line, or open Browse from the sheet's bar. Download, the connection, the theme and the shortcuts move into the ⋯ menu.