ER (entity-relationship) diagrams
The shape of your data: the tables, the columns, the keys, and the relationships between them. Skeema generates an ER diagram from a prompt or a database node, validates it, and turns it into runnable schema code.
What is an ER diagram?
An entity-relationship (ER) diagram models the data a system stores. An entitybecomes a table (e.g. User, Order); its attributes become columns; and relationships describe how entities reference one another. It’s the blueprint a relational database is built from.
Keys
- Primary key (PK)
- A column (or set) that uniquely identifies each row — usually an
id. Skeema marks it with a key icon and injects one automatically if the model forgets. - Foreign key (FK)
- A column that references the primary key of another table, creating a relationship. Marked with a link icon.
- Unique / nullable
- Constraints shown as
UQand?modifiers — whether a value must be unique, and whether it may be empty.
Cardinality & junctions
Relationships have a cardinality: one-to-one, one-to-many, or many-to-many. A many-to-many (e.g. students ↔ courses) can’t be stored directly — it needs a junction table (a join table) holding two foreign keys. Skeema detects junctions automatically (an entity with exactly two FKs and little else) and tags them with a JUNCTION badge, placing them lower in the layout so the parent tables read clearly.
Normalization (the short version)
Normalization is organizing columns so each fact lives in exactly one place, which prevents update anomalies. The practical rules Skeema’s health check looks for:
- •1NF — atomic columns; no repeating groups or comma-lists in a field.
- •2NF — non-key columns depend on the whole primary key, not part of it.
- •3NF — non-key columns depend only on the key, not on other non-key columns.
How Skeema generates ER diagrams
- •From a prompt — describe the domain; Skeema returns 5–12 entities with keys, enums, and inferred FKs.
- •From a database node — derive the schema directly from your architecture, carrying lineage.
- •From pasted schema — paste Prisma, PostgreSQL, or MySQL and a hybrid regex-plus-AI parser reconstructs the diagram.
Validation & code
Every ER board runs the schema-health check (9 rules, graded A–F) and can emit code through the codegen drawer — Prisma, PostgreSQL, MySQL, and Mongoose — deterministically, with no AI cost. See /docs/schema-health and /docs/code-generation.
- ✓Entities are tables, attributes are columns, relationships are foreign keys.
- ✓Many-to-many relationships need a junction table — Skeema detects and badges them.
- ✓Normalization keeps each fact in one place; denormalize deliberately, never by accident.
- ✓Generate from a prompt, a database node, or pasted schema — then validate and generate code.