Maowl Open Maowl

Columns, data types, and keys

Give each column a name, a data type, and an example value. Mark the columns that make up the primary key, and add defaults, descriptions, indexes, and checks where you need them.

Column, Data type, and Example

Edit columns in the side panel's Edit tab, or double-click a table to edit them right on the canvas. Either way, you'll see the same three fields:

Tables you import from a schema file or pasted CREATE TABLE statements keep their data types as your database writes them, such as VARCHAR(50) or NUMERIC(10,2), and the export writes them back the same way. Switching the model to another database changes every column to the closest type there.

Add a column in the empty row at the bottom: Tab moves between its fields, and Enter saves the whole row as one undo step. To set the name and data type in one go, type name: TYPE in the Column field, such as order_id: integer. Common spellings work too, so quantity: int gets your database's integer type. Each column name can appear only once in a table, and it can't be all digits.

Primary key, Unique, and Required

At the top of the data type list are three checkboxes: Unique, Required (NOT NULL), and Primary key. Check Primary key on several columns for a composite key; the table's details in the Edit tab show the key in order, and the up and down buttons there change it. Key columns are always required. In the SQL export, the key becomes the PRIMARY KEY, any other unique column gets UNIQUE, and every required column gets NOT NULL. On the canvas, a required column gets a ! after its data type, and a unique column's line ends with the word unique.

Column details

The arrow at the end of a column's row opens its details, in the side panel and on a card you're editing on the canvas:

The arrow turns blue when a column has details, so you can spot them at a glance.

Table details

Below the columns, the Edit tab has the selected table's schema (such as sales or dbo; leave it empty for the default) and description, its primary key in order, indexes (an optional name, the columns in order, and Unique), and check constraints (an optional name and a condition such as quantity > 0). Two tables can share a name in different schemas.

Reorder columns

Drag a row by the dots at its far left, either in the side panel or on the canvas. A line shows where the row will land. The export writes the columns in the same order, and the first column's example value appears on the card as its caption.

Paste several columns at once

Paste one of these into the Column field of the empty row at the bottom, and we'll add all of its columns in a single undo step:

If a column already exists, we keep its data type, example, and settings and only fill in what's missing. A message sums up what was added and what already existed.

How columns are drawn

On a card, the columns fill the space below the caption in three columns: column name, data type, and example value. A small PK marks the primary key's columns and FK the columns a foreign key holds. With Square mode off, a table's columns are listed in a box below its circle, one per line, as name: TYPE (example) or whichever parts you've filled in. To style the cards, open the Format tab. To show or hide every column at once, use the Columns layer in the Layers tab. SQL and JSON exports always include every column, even when that layer is hidden.

For teams that also use Neo4j

The Cypher export translates each data type to the closest Neo4j property type, turns the primary key into constraints, and writes each example value to match its type. See Export.

Related