Entities and their fields are the heart of any ERD. In Schemity a table is called an entity; the columns are fields. This page explains every property so the editor holds no surprises.
Adding an entity
Add an entity from the control bar and give it a name (typically a plural noun like users or orders). At the entity level you can also set:
- Name - the table name.
- Description - optional notes.
- Color - a custom color for the entity header.
- Charset and Collation - shown for MySQL only.
Field properties
Each field exposes these properties in the field editor:
- Field name - the column name, for example
emailorcreated_at. - Data type - the column type, with Length, Precision, and Scale where the type supports them. The available types match the connectionâs engine (PostgreSQL, MySQL, SQL Server, or SQLite), shown as âFrequently usedâ and âAll typesâ.
- Default value - a default chosen from type-specific options, or
CUSTOMto enter your own expression. - Description - optional notes on the field.
- PK - marks the field as part of the primary key. Mark more than one field to form a composite primary key.
- Unique - enforces a single-column unique constraint. For multi-column rules, see Check Constraints & Composite Unique.
- Nullable - whether the column allows
NULL. Clear it to make the columnNOT NULL. - Charset and Collation - shown for MySQL only.
Surrogate keys are expressed through the fieldâs data type and default (for example a serial/identity type with its engine-appropriate default), chosen from the type and default-value options above.
Foreign key fields
A field becomes a foreign key when you draw a relationship from its entity to another entityâs key. Schemity adds and keeps the foreign key field in sync with the relationship.
Good habits
- Give every entity a primary key.
- Use consistent naming - Schemityâs Naming setting (
snake_caseorcamelCase) keeps generated names uniform. - Set nullability deliberately; defaulting everything to nullable hides real constraints.
Next
Give every new entity the same starting fields with Templates.