Skip to content

014 — No denormalized owner on domains

Context

Current owner could be cached as domains.owner_user_domain_id for cheaper reads. Under claim races and concurrent verify paths, that column would drift unless every write updates it in the same batch as the partial unique index — duplicating the source of truth.

Decision

Do not store an owner pointer on domains. Current owner is always derived: user_domains where domain_id = ?, status = 'verified', deleted_at IS NULL, enforced by user_domains_one_verified_per_domain.

Consequences

  • Reads join or call findVerifiedOwner; fine at this scale.
  • Ownership invariants stay in one place (partial unique index + CAS updates).