Field Manual PHP / Laravel reference
← Engineering

Database design

Schema design makes relationships and integrity explicit.

What it is

Schema design makes relationships and integrity explicit.

When to use it

Choose keys, constraints, and indexes from access paths and business rules.

Syntax

PK + FK + NOT NULL + UNIQUE + CHECK + targeted indexes

Example

orders.user_id -> users.id
orders.reference UNIQUE
orders.total_cents NOT NULL
index orders(user_id, status, id)
Deletion: restrict settled financial history.

Common mistakes

Application validation alone cannot ensure integrity; avoid premature denormalization.

Related topics

07. Design data model08. Design API / interfaces09. Design architecture