Phase 3 — Architecture & Engineering
Database Specification
Every table, every relationship, every constraint — resolved before the first migration
2 min read · Document 11 of 30
What is this document?
The Database Specification is the complete schema: tables, columns, types, constraints, indexes, enums and the reasons behind each non-obvious choice. It includes a runnable schema file.
CREAH applies the generated schema to a scratch database during its quality checks, so it is known to run.
Why does it matter?
- Schema decisions made late are schema migrations made often.
- In a multi-space product each migration risks breaking several apps at once.
- Constraints in the database catch bugs that application code misses.
What's inside?
- Tables and columns — Types, nullability, defaults and checks.
- Relationships and indexes — Foreign keys and the queries they support.
- Data lifecycle — Soft deletes, retention and audit tables.
Domain modelTablesConstraintsScratch DB check
How CREAH generates it
CREAH builds this document from your Stage 0 answers and interview. Questions that shape it include:
- Which records may be deleted, and which only archived?
- Which lookups must be fast at scale?
- What must be audited?
Example excerpt
## platform_projects
id uuid PRIMARY KEY
project_name text NOT NULL
project_type enum('static_website','multi_space_app')
status enum('draft','paid','interviewing', …)
deleted_at timestamptz -- soft delete only