Status: Accepted (in force). Reconstructed.

Context

PaidHR is multi-tenant. Each organisation has its own TenantDb; a single platform-wide MembershipDb holds cross-tenant identity and reference data. A "person" needs both a rich HR record (department, paygrade, bank, history) and a login.

Decision

Split identity across two stores:

The Person carries the HR data; the ApplicationUser carries authentication. Most People queries scope by accessor.company_id; some admin queries by accessor.organisation_id.

Consequences

Good: clean tenant isolation of HR data; a single identity store for auth; sub-companies in one Org share a TenantDb and can be queried together (enabling cross-account managers).

Bad / costs: identity is split across two DBs — creating a person touches both; cross-Org queries aren't possible without going through Membership; you must always resolve both organisation_id and company_id per request.

Alternatives

Related

technical §2, §34.