Models¶
Persistent domain models — entities backed by tables in Postgres. Each file describes one model: its fields, constraints, invariants, and relationships.
Conventions¶
- One file per model, kebab-case filename matching the entity name (
user.md,email-authentication.md). - Document the model before writing code, and keep the two in sync. The wiki captures intent;
OnModelCreating(and the resulting migration) is the executable schema. If they disagree, treat the discrepancy as a bug. - All foreign keys use
ON DELETE RESTRICTandON UPDATE RESTRICT(project policy — seeCLAUDE.md). Document the behavior explicitly in each relationship. - Timestamps are stored in UTC (
timestamp with time zone). - Primary keys are
uuid(Guidin .NET) unless a model has a clear reason otherwise.
Index¶
- User — the person registered with Molib; spine of auth and personnel concepts.
- EmailAuthentication — authenticates a User by email address.
- RefreshToken — server-side state behind rotating refresh tokens (see ADR 0002).