Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
3.3 KiB
Campus and Domain Model
Purpose
Campus is the top-level administrative and language-default boundary. Domain is the host-selected subdomain space presented to a request. Every Domain belongs to exactly one Campus.
This slice intentionally stops before ZoneTree. Quartier, Street, Spot, and SpotGraph remain later topology work.
Identity
Both Campus and Domain have:
- an integer SQLite row ID for local administration;
- a stable UUID for relationships;
- a normalized, unique machine name;
- a human-readable title;
- an enabled flag;
- a creation timestamp.
Campus additionally has a BCP 47 default language, authority mode, and FQDN.
Domain additionally has a host selector. A selector can be a full host
(docs.example.test), a subdomain label (docs), or empty to select the
Campus FQDN itself.
Ownership invariants
- Every Domain
campus_uuidresolves to an existing Campus. - At least one Campus exists and at least one Campus remains enabled.
- A Campus referenced by a Domain cannot be deleted.
- A Campus referenced by a Domain cannot be disabled.
- Creating or moving a Domain requires an enabled target Campus.
- Disabled Domains do not participate in request-host selection.
- Request-host resolution is exact and has no last-resort Domain fallback.
- An empty Domain host matches only its owning Campus FQDN.
- The request Campus is derived from the resolved Domain; it is not selected independently.
SQLite does not currently rebuild legacy tables to add a foreign-key constraint. These invariants are enforced by store operations so existing installations can migrate without destructive table replacement.
Schema
CREATE TABLE campuses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
uuid TEXT NOT NULL UNIQUE,
name TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
default_lang TEXT NOT NULL DEFAULT 'en',
authority_mode TEXT NOT NULL DEFAULT 'standalone',
fqdn TEXT NOT NULL,
enabled INTEGER NOT NULL DEFAULT 1,
created_at INTEGER NOT NULL
);
-- Added to domains during initialization:
ALTER TABLE domains ADD COLUMN campus_uuid TEXT;
CREATE INDEX idx_domains_campus_uuid ON domains(campus_uuid);
Startup migration
Initialization is idempotent:
- The existing District-to-Domain compatibility migration runs.
- If no Campus exists,
Default Campusis created. - The nullable
domains.campus_uuidcolumn is added when absent. - Empty, unknown, and legacy Campus references are assigned to the enabled default Campus.
UUIDs, Domain host selectors, and existing paths are preserved.
Request context
The server resolves one Domain from the HTTP Host and then resolves its
owning Campus. Both values are exposed as RequestContext.Domain and
RequestContext.Campus.
Revision language selection uses this order:
- explicit language request;
- request language preferences;
- Campus default language;
- system locale;
- language-neutral revision;
- latest revision.
Administration
The Config view supports Campus create, update, and delete, as well as Domain assignment to a Campus. The last enabled Campus cannot be disabled. A Campus must first have its Domains moved or deleted before it can be deleted.
The data CLI remains object/path/revision/asset oriented. Campus and Domain administration is therefore not added to the CLI in this slice.