Appearance
Data Dictionary
Every table and every column in the Phanera schema: type, whether a value is required, size limits, defaults, keys and foreign keys, with a description wherever the model carries one.
Read it alongside the entity relationship diagram, which shows the same schema as a picture. Together they are the reference an authority — or a supplier taking over from us — needs to read a data export without reverse-engineering it.
Generated, not written
This page is generated from the Entity Framework model snapshot that produces the database migrations, so it describes the schema the application actually runs against and cannot drift from it. Regenerate with python3 generate-data-dictionary.py.
89 tables, 978 columns. Types are PostgreSQL types.
How to read a table
| Heading | Meaning |
|---|---|
| Column | Column name as it appears in the database and in a CSV/JSON export |
| Type | PostgreSQL type. Text (max n) is character varying(n) |
| Required | Yes — NOT NULL. No — the column may be empty |
| Notes | Primary key, foreign key and its delete behaviour, uniqueness, default value, and a description where the model carries one |
Cases and correspondence
Requests
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CategoryId | UUID | No | FK → Categories (on delete: SetNull) |
ClockStopReason | Text | No | — |
ClockStopReasonType | Integer | No | — |
ClockStopped | Boolean | Yes | — |
ClockStoppedAt | Timestamp (UTC) | No | — |
ComplaintCategoryId | Integer | No | — |
ComplaintStage | Integer | No | — |
ConsentGiven | Boolean | Yes | — |
ConsentIpAddress | Text (max 45) | No | — |
ConsentTimestamp | Timestamp (UTC) | No | — |
ConsultationDeadline | Timestamp (UTC) | No | — |
ConsultationNotes | Text | No | — |
ConsultationRequired | Boolean | Yes | — |
ConsultationThirdParty | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DateReceived | Timestamp (UTC) | Yes | — |
DeadlineDate | Timestamp (UTC) | Yes | — |
DeadlineOverridden | Boolean | Yes | True once someone has set DeadlineDate by hand rather than letting the regime's rules calculate it (Ealing RFQ F03) |
DeadlineOverrideReason | Text (max 500) | No | Why the deadline currently stands where it does |
Description | Text | Yes | — |
EmailMessageId | Text | No | RFC 2822 Message-ID of the original inbound email that created this request |
ExtensionApplied | Boolean | Yes | — |
ExtensionDays | Integer | No | — |
ExtensionReason | Text (max 500) | No | — |
FeeAmount | Decimal | No | — |
FormFieldsData | JSON | Yes | — |
IdentityVerificationRequired | Boolean | Yes | — |
IdentityVerified | Boolean | Yes | — |
IdentityVerifiedAt | Timestamp (UTC) | No | — |
IdentityVerifiedByUserId | Text | No | — |
IsOnLegalHold | Boolean | Yes | True while the case is under legal hold: retention is suspended and nothing about it may be disposed of, however far past its retention period it is |
IsPublished | Boolean | Yes | — |
IsSpam | Boolean | Yes | — |
IsTransferred | Boolean | Yes | — |
IsTrashed | Boolean | Yes | — |
Language | Text | Yes | — |
LegalHoldPlacedAt | Timestamp (UTC) | No | When the current hold was placed |
LegalHoldPlacedByUserId | Text | No | Who placed the current hold |
LegalHoldPlacedByUserName | Text | No | Display name of LegalHoldPlacedByUserId, captured at the time |
LegalHoldReason | Text | No | Why the case is held — the matter, claim or reference the hold is for |
LegalHoldReviewDueAt | Timestamp (UTC) | No | When the hold falls due for review, computed at the moment it is placed from the request type's own period or the organisation's default — see LegalHoldPolicy |
MergedAt | Timestamp (UTC) | No | — |
MergedIntoRequestId | UUID | No | FK → Requests (on delete: SetNull) |
Notes | Text | No | — |
OmbudsmanOutcome | Text (max 50) | No | — |
OmbudsmanReferenceNumber | Text (max 50) | No | — |
OmbudsmanReferralLogged | Boolean | Yes | — |
OmbudsmanReferredAt | Timestamp (UTC) | No | — |
OmbudsmanType | Text | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
OriginalDeadlineDate | Timestamp (UTC) | No | — |
PipelineId | UUID | No | FK → EmailPipelines (on delete: SetNull) |
PublishedAt | Timestamp (UTC) | No | — |
PublishedSummary | Text (max 500) | No | — |
ReferenceNumber | Text (max 30) | Yes | — |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade) |
RequesterEmail | Text (max 254) | Yes | — |
RequesterFirstName | Text (max 200) | Yes | — |
RequesterLastName | Text (max 200) | Yes | — |
RequesterPhone | Text (max 20) | No | — |
ResponseDraft | Text | No | — |
ResponseSentAt | Timestamp (UTC) | No | — |
SearchVector | tsvector | Yes | Weighted full-text index over the case's own words, computed by Postgres from the row (Ealing RFQ F11) |
Sensitivity | Text | Yes | Handling classification (UK Government Security Classifications) |
SensitivityReason | Text (max 500) | No | Why the case carries the marking it does |
Source | Text (max 20) | Yes | — |
Stage1ClosedAt | Timestamp (UTC) | No | — |
Stage1Outcome | Text | No | — |
Stage1Response | Text | No | — |
Stage2ClosedAt | Timestamp (UTC) | No | — |
Stage2Outcome | Text | No | — |
Stage2Response | Text | No | — |
Status | Text | Yes | — |
StatutoryDeadlineDate | Timestamp (UTC) | No | The deadline the rules produced, captured the first time it was overridden and left alone afterwards |
Title | Text | No | — |
TransferReason | Text (max 1000) | No | — |
TransferredAt | Timestamp (UTC) | No | — |
TransferredToAuthority | Text (max 300) | No | — |
TrashedAt | Timestamp (UTC) | No | — |
Composite indexes: (FormFieldsData, IX_Requests_FormFieldsData), (FormFieldsData, gin), (SearchVector, IX_Requests_Search), (SearchVector, GIN), (OrganisationId, ReferenceNumber), (OrganisationId, Sensitivity, IX_Requests_OrgSensitivity), (RequestTypeId, OrganisationId), (OrganisationId, Status, DeadlineDate, IX_Requests_OrgDeadline)
RequestMessages
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
Body | Text (max 8000) | Yes | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
EmailMessageId | Text (max 500) | No | RFC 2822 Message-ID header value, set on outgoing emails for reply threading |
EmailSent | Boolean | Yes | Whether the message was sent as an email to the requester |
IsDisclosed | Boolean | Yes | Whether this message has been selected for disclosure on the public disclosure log |
OrganisationId | UUID | Yes | — |
ReplyToMessageId | UUID | No | The message this is a reply to, if any |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
SearchVector | tsvector | Yes | Weighted full-text index over the correspondence itself — subject (A), body (B) and sender (C) — computed by Postgres from the row (Ealing RFQ F11) |
SenderName | Text (max 200) | Yes | Display name of sender |
SenderType | Text (max 20) | Yes | "Staff" or "Requester" |
SenderUserId | Text | No | Staff user ID when sent by staff, null for requester messages |
Subject | Text (max 500) | No | Optional subject line (used as email subject when emailing the requester) |
Composite indexes: (EmailMessageId, IX_RequestMessages_EmailMessageId), (SearchVector, IX_RequestMessages_Search), (SearchVector, GIN), (RequestId, CreatedAt, IX_RequestMessages_ReqCreated)
MessageAttachments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobUrl | Text (max 500) | Yes | — |
FileName | Text (max 255) | Yes | — |
FileSizeBytes | Integer (64-bit) | Yes | — |
IsDisclosed | Boolean | Yes | Whether this attachment has been selected for disclosure on the public disclosure log |
MessageId | UUID | Yes | FK → RequestMessages (on delete: Cascade) |
MimeType | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | — |
RedactedAt | Timestamp (UTC) | No | — |
RedactedBlobUrl | Text (max 500) | No | Blob of the redacted copy served to the public |
RedactedByUserId | Text | No | — |
RedactedFileSizeBytes | Integer (64-bit) | No | — |
UploadedAt | Timestamp (UTC) | Yes | default now() |
RequestAttachments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AttachmentSource | Text (max 20) | Yes | — |
AttachmentType | Text (max 50) | No | — |
BlobUrl | Text (max 500) | Yes | — |
DeletedAt | Timestamp (UTC) | No | When the file was soft-deleted; drives permanent cleanup after the grace period |
FileName | Text (max 255) | Yes | — |
FileSizeBytes | Integer (64-bit) | Yes | — |
IsDeleted | Boolean | Yes | — |
MimeType | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
UploadedAt | Timestamp (UTC) | Yes | default now() |
UploadedByUserId | Text | No | — |
Version | Integer | Yes | — |
RequestTimeline
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 500) | Yes | — |
EventType | Text (max 50) | Yes | — |
Metadata | Text | No | — |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
UserId | Text | No | — |
UserName | Text (max 200) | No | — |
RequestAssignments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AssignedAt | Timestamp (UTC) | Yes | default now() |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
UserId | Text (max 450) | Yes | FK → AspNetUsers (on delete: Cascade) |
Composite indexes: (RequestId, UserId, IX_RequestAssignments_ReqUser)
RequestDepartments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AssignedAt | Timestamp (UTC) | Yes | default now() |
DepartmentId | UUID | Yes | FK → Departments (on delete: Cascade) |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
Composite indexes: (RequestId, DepartmentId, IX_RequestDepartments_ReqDept)
RequestApprovals
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ClaimedAt | Timestamp (UTC) | No | — |
ClaimedByUserId | Text (max 450) | No | Advisory claim, in the spirit of a GitHub review assignment: any approver in scope may decide, but claiming signals to the rest of the pool that someone has it |
ClaimedByUserName | Text (max 200) | No | — |
DecidedAt | Timestamp (UTC) | No | — |
DecidedByUserId | Text (max 450) | No | — |
DecidedByUserName | Text (max 200) | No | — |
DecisionComment | Text (max 2000) | No | — |
EmailPipelineId | UUID | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Outcome | Text (max 50) | Yes | — |
PreviousStatus | Text (max 30) | Yes | Status the request held at submission, restored when the approval is rejected or cancelled |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
RequestedAt | Timestamp (UTC) | Yes | default now() |
RequestedByUserId | Text (max 450) | Yes | — |
RequestedByUserName | Text (max 200) | Yes | — |
Status | Text (max 20) | Yes | — |
Subject | Text (max 500) | No | — |
SubmissionNote | Text (max 2000) | No | — |
UserMailConnectionId | UUID | No | — |
Composite indexes: (RequestId, UX_RequestApprovals_RequestPending), (OrganisationId, Status, IX_RequestApprovals_OrgStatus), (RequestId, RequestedAt, IX_RequestApprovals_RequestRequestedAt)
RequestBlockers
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlockedOnDepartmentId | UUID | No | FK → Departments (on delete: SetNull); Department whose input the request is stalled on (third-party performance alerts) |
Description | Text (max 2000) | Yes | — |
EscalatedAt | Timestamp (UTC) | No | Set by the deadline hosted service when the blocker overruns; doubles as escalation-email dedup |
ExpectedResolutionDate | Timestamp (UTC) | No | When the raiser expects the blocker to clear; escalation fires once this passes |
OrganisationId | UUID | Yes | — |
RaisedAt | Timestamp (UTC) | Yes | default now() |
RaisedByUserId | Text (max 450) | Yes | — |
RaisedByUserName | Text (max 200) | No | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
ResolutionNote | Text (max 2000) | No | — |
ResolvedAt | Timestamp (UTC) | No | — |
ResolvedByUserId | Text (max 450) | No | — |
ResolvedByUserName | Text (max 200) | No | — |
Type | Text (max 30) | Yes | — |
Composite indexes: (RequestId, IX_RequestBlockers_Request), (OrganisationId, ResolvedAt, IX_RequestBlockers_OrgResolved)
RequestMilestones
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CompletedAt | Timestamp (UTC) | No | — |
CompletedByUserId | Text (max 450) | No | — |
CompletedByUserName | Text (max 200) | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DaysBeforeDeadline | Integer | Yes | Kept so due dates can be recomputed when the deadline moves (extension / clock restart) |
DueDate | Timestamp (UTC) | Yes | — |
MissedNotifiedAt | Timestamp (UTC) | No | When the missed-milestone alert went out; dedup for the tripwire email |
Name | Text (max 200) | Yes | — |
NameCy | Text (max 200) | No | — |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
SortOrder | Integer | Yes | — |
TemplateId | Integer | No | Template this was materialised from; null for ad-hoc milestones |
Composite indexes: (RequestId, IX_RequestMilestones_Request), (OrganisationId, DueDate, IX_RequestMilestones_OrgDueIncomplete)
RequestMilestoneDependencies
| Column | Type | Required | Notes |
|---|---|---|---|
MilestoneId | UUID | Yes | PK; FK → RequestMilestones (on delete: Cascade); The dependent — the milestone that is held up |
DependsOnMilestoneId | UUID | Yes | PK; FK → RequestMilestones (on delete: Cascade); The predecessor — the milestone that must be completed first |
OrganisationId | UUID | Yes | — |
Composite indexes: (DependsOnMilestoneId, IX_RequestMilestoneDependencies_DependsOn)
RequestCostActivities
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
Description | Text | No | — |
Hours | Decimal | Yes | Estimated or actual staff hours spent |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
Type | Text | Yes | — |
Composite indexes: (OrganisationId, RequestId)
RequestRefusals
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text (max 450) | Yes | — |
CreatedByUserName | Text (max 200) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
PartialDisclosure | Boolean | Yes | — |
RefusalBasis | Text (max 4000) | No | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
RequestRefusalExemptions
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ExemptionId | UUID | No | FK → Exemptions (on delete: SetNull); The library entry relied on, or null once that entry has been deleted |
IsAbsolute | Boolean | Yes | — |
Name | Text (max 200) | Yes | — |
NameCy | Text (max 200) | No | — |
RequestRefusalId | UUID | Yes | FK → RequestRefusals (on delete: Cascade) |
RequestTypeId | Integer | Yes | — |
SectionRef | Text (max 20) | No | — |
SortOrder | Integer | Yes | — |
Composite indexes: (RequestRefusalId, ExemptionId, IX_RequestRefusalExemptions_RefExempt)
SubRequests
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
AssignedToUserId | Text | No | — |
AssignedToUserName | Text | No | — |
CompletedAt | Timestamp (UTC) | No | — |
CompletedByUserId | Text | No | — |
CompletedByUserName | Text | No | — |
CompletionNote | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
DepartmentId | UUID | No | FK → Departments (on delete: SetNull); Department responsible for this part of the request |
Description | Text | No | — |
DueDate | Timestamp (UTC) | No | Internal due date; independent of the parent's statutory deadline |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
Title | Text (max 300) | Yes | — |
Composite indexes: (OrganisationId, RequestId)
RelatedRequests
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
Note | Text (max 1000) | No | Why these two are linked, in the officer's own words |
OrganisationId | UUID | Yes | — |
RelatedRequestId | UUID | Yes | FK → Requests (on delete: Cascade); The higher of the two ids |
RelationType | Text (max 20) | Yes | See RelatedRequestType |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade); The lower of the two ids |
Composite indexes: (OrganisationId, RelatedRequestId, IX_RelatedRequests_OrgRelated), (RequestId, RelatedRequestId, IX_RelatedRequests_Pair)
InternalReviews
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ConcludedAt | Timestamp (UTC) | No | — |
ConcludedByUserId | Text (max 450) | No | — |
ConcludedByUserName | Text (max 200) | No | — |
DueAt | Timestamp (UTC) | Yes | When the review itself is due — its own clock, not the case's |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Outcome | Text (max 30) | No | — |
OutcomeNotes | Text (max 4000) | No | — |
PreviousStatus | Text (max 30) | Yes | The status the case held when the review started, restored when the original decision stands |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
RequestedAt | Timestamp (UTC) | Yes | default now() |
RequestedByUserId | Text (max 450) | Yes | The officer who logged the review, not the requester who asked for it |
RequestedByUserName | Text (max 200) | Yes | — |
RequesterReason | Text (max 4000) | No | Why the requester is unhappy, in their terms |
Status | Text (max 20) | Yes | — |
Composite indexes: (RequestId, UX_InternalReviews_RequestOpen), (OrganisationId, Status, IX_InternalReviews_OrgStatus), (RequestId, RequestedAt, IX_InternalReviews_RequestRequestedAt)
InternalReviewPreviousHandlers
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
InternalReviewId | UUID | Yes | FK → InternalReviews (on delete: Cascade) |
UserId | Text (max 450) | Yes | — |
UserName | Text (max 200) | Yes | — |
Composite indexes: (InternalReviewId, IX_InternalReviewPreviousHandlers_ReviewId)
ResponseDraftFiles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobUrl | Text (max 500) | Yes | — |
ComplaintStage | Integer | No | — |
DeletedAt | Timestamp (UTC) | No | When the file was soft-deleted; drives permanent cleanup after the grace period |
FileName | Text (max 255) | Yes | — |
FileSizeBytes | Integer (64-bit) | Yes | — |
IsDeleted | Boolean | Yes | — |
MimeType | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | — |
PdfTemplateId | UUID | No | FK → PdfTemplates (on delete: SetNull); The template this file was generated from, if any |
PdfTemplateName | Text (max 200) | No | Template name at the point of generation |
RedactedAt | Timestamp (UTC) | No | — |
RedactedBlobUrl | Text (max 500) | No | Blob of the redacted copy served to the public |
RedactedByUserId | Text | No | — |
RedactedFileSizeBytes | Integer (64-bit) | No | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
TemplateInputsJson | Text | No | The officer's input values as JSON, keyed the same way the template's fill fields are: |
UploadedAt | Timestamp (UTC) | Yes | default now() |
UploadedByUserId | Text | No | — |
Composite indexes: (OrganisationId, PdfTemplateId, IX_ResponseDraftFiles_OrgTemplate)
RequestEmbeddings
| Column | Type | Required | Notes |
|---|---|---|---|
RequestId | UUID | Yes | PK |
ContentHash | Text | Yes | SHA-256 of the indexed content — used to skip re-indexing unchanged requests |
Embedding | vector(3072) | Yes | 3072-dimensional embedding produced by Gemini gemini-embedding-exp-03-07 |
IndexedAt | Timestamp (UTC) | Yes | — |
OrganisationId | UUID | Yes | — |
Requesters and identity
RequesterFlags
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
IsVexatious | Boolean | Yes | — |
NormalizedEmail | Text (max 254) | Yes | Lowercased, trimmed email used as a stable lookup key |
Notes | Text (max 4000) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UpdatedAt | Timestamp (UTC) | No | — |
VexatiousFlaggedAt | Timestamp (UTC) | No | — |
VexatiousFlaggedByUserId | Text (max 450) | No | — |
VexatiousReason | Text (max 2000) | No | — |
Composite indexes: (OrganisationId, NormalizedEmail, IX_RequesterFlags_OrgEmail)
IdentityDocuments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobUrl | Text (max 500) | Yes | — |
FileName | Text (max 255) | Yes | — |
FileSizeBytes | Integer (64-bit) | Yes | — |
MimeType | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | — |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
UploadedAt | Timestamp (UTC) | Yes | default now() |
Documents and redaction
FileRedactions
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text (max 450) | No | — |
CreatedByUserName | Text (max 200) | No | — |
ExemptionId | UUID | No | FK → Exemptions (on delete: SetNull); The exemption relied on |
ExemptionName | Text (max 200) | No | — |
ExemptionSectionRef | Text (max 20) | No | — |
Height | double precision | Yes | — |
Note | Text (max 2000) | No | Optional officer note explaining the specific application of the exemption |
OrganisationId | UUID | Yes | — |
PageNumber | Integer | Yes | 1-based page number in the original document |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade) |
Source | Text | Yes | — |
TargetId | UUID | Yes | ResponseDraftFile.Id or MessageAttachment.Id, per TargetKind |
TargetKind | Text | Yes | — |
Width | double precision | Yes | — |
X | double precision | Yes | — |
Y | double precision | Yes | — |
Composite indexes: (RequestId, IX_FileRedactions_Request), (OrganisationId, TargetKind, TargetId, IX_FileRedactions_OrgTarget)
DocumentTexts
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
Attempts | Integer | Yes | How many times extraction has been attempted |
Content | Text | No | The text read out of the file, truncated to MaxContentLength |
CreatedAt | Timestamp (UTC) | Yes | default now() |
ExtractedAt | Timestamp (UTC) | No | — |
FailureReason | Text (max 500) | No | Why extraction failed, for the file types that were tried and did not work |
FileName | Text (max 255) | Yes | — |
MimeType | Text (max 200) | No | — |
OrganisationId | UUID | Yes | — |
OwnerId | UUID | Yes | — |
OwnerType | Text (max 40) | Yes | Which file table OwnerId points into: see DocumentOwnerType |
RequestId | UUID | Yes | FK → Requests (on delete: Cascade); The case the file belongs to |
SearchVector | tsvector | Yes | Weighted full-text index over the file name (A) and its contents (B), computed by Postgres from the row |
Status | Text (max 20) | Yes | See DocumentTextStatus |
Composite indexes: (SearchVector, IX_DocumentTexts_Search), (SearchVector, GIN), (OrganisationId, RequestId, IX_DocumentTexts_OrgRequest), (OwnerType, OwnerId, IX_DocumentTexts_Owner), (Status, CreatedAt, IX_DocumentTexts_Pending)
RedactionSuggestionCaches
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
HitCount | Integer | Yes | — |
LastUsedAt | Timestamp (UTC) | Yes | default now(); Bumped on every hit, so cleanup can evict what nobody is reusing |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
PayloadHash | Text (max 64) | Yes | SHA-256 over the document text, the request type, the exemption library, and the prompt version |
SuggestionsJson | Text | Yes | Serialised RedactionEntityDto list, stored exactly as it was returned |
Composite indexes: (LastUsedAt, IX_RedactionSuggestionCache_LastUsed), (OrganisationId, PayloadHash, IX_RedactionSuggestionCache_OrgHash)
StorageProviders
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AuthorizationEndpoint | Text (max 500) | No | — |
ClientId | Text (max 200) | Yes | — |
ClientSecret | Text (max 500) | No | — |
ConnectedAccount | Text (max 254) | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DisplayName | Text (max 200) | Yes | — |
DriveId | Text (max 300) | No | — |
IsEnabled | Boolean | Yes | — |
Kind | Text | Yes | — |
LastError | Text (max 500) | No | — |
LastVerifiedAt | Timestamp (UTC) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RefreshToken | Text (max 4000) | No | — |
RootFolderId | Text (max 300) | No | — |
RootFolderName | Text (max 500) | No | — |
Scopes | Text (max 1000) | No | — |
SiteUrl | Text (max 500) | No | — |
Status | Text (max 30) | Yes | — |
TenantId | Text (max 100) | No | — |
TokenEndpoint | Text (max 500) | No | — |
Composite indexes: (OrganisationId, IX_StorageProviders_Org)
Configuration
RequestTypes
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
OrganisationId | UUID | Yes | PK; FK → Organisations (on delete: Cascade) |
CanDisclose | Boolean | Yes | Whether requests of this type may be published to the disclosure log |
DeadlineSpan | interval | Yes | — |
DeletedAt | Timestamp (UTC) | No | When it was retired |
Description | Text | No | — |
DescriptionCy | Text | No | — |
InternalReviewDeadline | interval | No | Working days allowed for an internal review of a request of this type (Ealing RFQ T03) |
IsDeleted | Boolean | Yes | Retired from the pickers rather than destroyed |
LegalHoldReviewDays | Integer | No | Days a legal hold on a request of this type stands before it falls due for review (Ealing RFQ T07) |
Name | Text (max 100) | Yes | — |
NameCy | Text | No | — |
PortalDuplicateCheckEnabled | Boolean | Yes | Whether the portal offers matching disclosure log entries before a request of this type is submitted |
ReminderDays | Text | No | — |
RequiresIdentityVerification | Boolean | Yes | — |
RetentionDays | Integer | No | Number of days after closure (or trashing) before a request is permanently deleted |
Stage2Deadline | interval | No | — |
TypeCode | Text (max 5) | Yes | — |
Composite indexes: (OrganisationId, IsDeleted, IX_RequestTypes_OrgLive)
Categories
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 500) | No | — |
DescriptionCy | Text | No | — |
Name | Text (max 200) | Yes | — |
NameCy | Text | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
ParentCategoryId | UUID | No | FK → Categories (on delete: Cascade) |
SortOrder | Integer | Yes | — |
Composite indexes: (OrganisationId, Name, ParentCategoryId, IX_Categories_OrgNameParent)
CategoryDepartments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CategoryId | UUID | Yes | FK → Categories (on delete: Cascade) |
DepartmentId | UUID | Yes | FK → Departments (on delete: Cascade) |
Composite indexes: (CategoryId, DepartmentId, IX_CategoryDepartments_CatDept)
CategoryRequestTypes
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CategoryId | UUID | Yes | FK → Categories (on delete: Cascade) |
OrganisationId | UUID | Yes | — |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade) |
Composite indexes: (RequestTypeId, OrganisationId), (CategoryId, RequestTypeId, OrganisationId, IX_CategoryRequestTypes_CatRT)
Departments
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DeletedAt | Timestamp (UTC) | No | When it was retired |
Description | Text (max 500) | No | — |
IsDeleted | Boolean | Yes | Retired rather than destroyed |
Name | Text (max 200) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Composite indexes: (OrganisationId, Name, IX_Departments_OrgName)
DepartmentUsers
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AssignedAt | Timestamp (UTC) | Yes | default now() |
DepartmentId | UUID | Yes | FK → Departments (on delete: Cascade) |
UserId | Text (max 450) | Yes | FK → AspNetUsers (on delete: Cascade) |
Composite indexes: (DepartmentId, UserId, IX_DepartmentUsers_DeptUser)
Exemptions
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 1000) | No | — |
DescriptionCy | Text | No | — |
IsAbsolute | Boolean | Yes | — |
Name | Text (max 200) | Yes | — |
NameCy | Text | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade) |
SectionRef | Text (max 20) | No | — |
SortOrder | Integer | Yes | — |
Composite indexes: (RequestTypeId, OrganisationId), (OrganisationId, RequestTypeId, SectionRef, IX_Exemptions_OrgTypeSec)
MilestoneTemplates
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
OrganisationId | UUID | Yes | PK |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DaysBeforeDeadline | Integer | Yes | Business days before the request deadline that this checkpoint falls due |
Name | Text (max 200) | Yes | — |
NameCy | Text (max 200) | No | — |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade) |
SortOrder | Integer | Yes | — |
Composite indexes: (RequestTypeId, OrganisationId)
MilestoneTemplateDependencies
| Column | Type | Required | Notes |
|---|---|---|---|
TemplateId | Integer | Yes | PK; FK → MilestoneTemplates (on delete: Cascade); The dependent — the checkpoint that is held up |
DependsOnTemplateId | Integer | Yes | PK; FK → MilestoneTemplates (on delete: Cascade); The predecessor — the checkpoint that must be completed first |
OrganisationId | UUID | Yes | PK |
Composite indexes: (DependsOnTemplateId, OrganisationId, IX_MilestoneTemplateDependencies_DependsOn), (TemplateId, OrganisationId)
ResponseTemplates
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BodyHtml | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
IsActive | Boolean | Yes | — |
Name | Text (max 200) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, Name, IX_ResponseTemplates_OrgName)
PdfTemplates
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobUrl | Text | No | Blob path of the uploaded PDF |
BodyHtml | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
FieldMappingsJson | Text | No | JSON array of AcroForm field mappings: [{ "fieldName", "source", "token", "label", "required" }] |
FileName | Text | No | Original uploaded file name |
InputFieldsJson | Text | No | JSON array of custom input fields: [{ "token", "label", "required" }] |
IsActive | Boolean | Yes | — |
Kind | Text (max 10) | Yes | Template source: "Html" (rich-text authored) or "Pdf" (uploaded AcroForm PDF) |
Name | Text (max 200) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, Name, IX_PdfTemplates_OrgName)
OrganisationEmailTemplates
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BodyHtml | Text | Yes | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Language | Text (max 10) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Subject | Text (max 500) | Yes | — |
TemplateType | Text (max 50) | Yes | — |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, TemplateType, Language, IX_OrgEmailTemplates_OrgTypeLang)
EmailTemplateImages
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobPath | Text (max 500) | Yes | — |
ContentType | Text (max 100) | Yes | — |
FileSizeBytes | Integer (64-bit) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UploadedAt | Timestamp (UTC) | Yes | default now() |
Url | Text (max 2000) | Yes | — |
FormSteps
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
FormInstructions | Text | No | — |
Language | Text (max 10) | Yes | — |
OrganisationId | UUID | Yes | — |
Page | Integer | Yes | — |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade) |
Title | Text | Yes | — |
Composite indexes: (RequestTypeId, OrganisationId)
FormFields
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
FormStepId | Integer | Yes | FK → FormSteps (on delete: Cascade) |
Format | Text | No | — |
IsRequired | Boolean | Yes | — |
IsStaffOnly | Boolean | Yes | Case metadata rather than a question for the requester: never rendered on the portal form, never submitted, and set by staff on the case after it arrives |
Key | Text (max 100) | No | The stable identifier a custom field's value is stored under in FormFieldsData, and the handle every filter and report uses |
Label | Text | Yes | — |
Order | Integer | Yes | — |
Type | Text | Yes | — |
Organisation, users and access control
Organisations
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BillingInterval | Text (max 10) | No | monthly or yearly |
CreatedAt | Timestamp (UTC) | Yes | default now() |
IcoRegistrationNumber | Text (max 20) | No | — |
Name | Text (max 200) | Yes | — |
OrgType | Text (max 50) | Yes | — |
PostalAddress | Text (max 500) | No | — |
RequestSequence | Integer | Yes | Last reference number allocated for RequestSequenceYear |
RequestSequenceYear | Integer | Yes | Calendar year RequestSequence belongs to; the sequence restarts each year |
StorageLimitBytes | Integer (64-bit) | Yes | 1 GB trial default |
StripeCustomerId | Text (max 50) | No | — |
StripeSubscriptionId | Text (max 50) | No | — |
SubscriptionPlanId | Integer | No | FK → SubscriptionPlans (on delete: NoAction) |
SubscriptionStatus | Text (max 20) | Yes | — |
TrialEndsAt | Timestamp (UTC) | No | — |
OrganisationSettings
| Column | Type | Required | Notes |
|---|---|---|---|
OrganisationId | UUID | Yes | PK |
AIEnabled | Boolean | Yes | — |
BackupIntervalHours | Integer | Yes | Hours between scheduled backups, between MinimumIntervalHours and MaximumIntervalHours |
BackupRetentionDays | Integer | Yes | Days a backup is kept before it is deleted, capped at MaximumDays |
BackupScheduleEnabled | Boolean | Yes | Take a backup of this organisation automatically, every BackupIntervalHours hours |
CaptchaEnabled | Boolean | Yes | — |
CaptchaSecretKey | Text | No | — |
CaptchaSiteKey | Text | No | — |
CostHourlyRatePounds | Decimal | Yes | Flat hourly rate for s.12 cost estimates (Fees Regulations 2004: £25/hour) |
CostLimitPounds | Decimal | Yes | s.12 FOIA appropriate limit in pounds (£450 for most authorities, £600 for central government) |
CustomDomain | Text (max 200) | No | — |
DefaultLanguage | Text (max 10) | Yes | — |
DisplayHeaderText | Boolean | Yes | — |
DisposalReviewRequired | Boolean | Yes | Require a person to authorise each disposal before the retention job destroys anything (Ealing RFQ T07) |
FooterTextColour | Text | No | — |
HeaderTextColour | Text | No | — |
HomeUrl | Text | No | — |
InboundEmailAddress | Text (max 200) | No | — |
LastBackupAt | Timestamp (UTC) | No | When the scheduler last completed a backup |
LastRetentionRunAt | Timestamp (UTC) | No | When the retention job last ran over this organisation (Ealing RFQ T07) |
LegalHoldReviewDays | Integer | Yes | The authority's house rule for how often a legal hold is reviewed, in days — see LegalHoldPolicy |
LinkColour | Text | No | — |
LogoUrl | Text (max 500) | No | — |
OfficerNamesInResponseDraftEnabled | Boolean | Yes | — |
PageTitle | Text (max 200) | No | — |
PrimaryColour | Text (max 7) | No | — |
PrivacyNoticeUrl | Text (max 500) | No | — |
PublicApiKeyAuthEnabled | Boolean | Yes | The public API accepts static API keys (Ealing RFQ T11) |
PublicApiOAuthEnabled | Boolean | Yes | The public API accepts OAuth 2.0 client-credentials access tokens |
PublicFooterText | Text (max 1000) | No | — |
PublicHeaderText | Text (max 500) | No | — |
Region | Text (max 30) | Yes | — |
RequesterNamesInResponseDraftEnabled | Boolean | Yes | — |
RequireTwoFactor | Boolean | Yes | Every member of this organisation must have an authenticator app enrolled (Ealing RFQ T02) |
ResponseApprovalRequired | Boolean | Yes | When enabled, a response cannot be sent directly — it must be submitted for approval and signed off by a user with the ApproveResponse permission |
SecondaryColour | Text (max 7) | No | — |
SubdomainSlug | Text (max 50) | Yes | unique |
UseGovUkTheme | Boolean | Yes | — |
WelshEnabled | Boolean | Yes | — |
OrganisationBrandingTranslations
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
Language | Text (max 10) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
PageTitle | Text (max 200) | No | — |
PublicFooterText | Text (max 1000) | No | — |
PublicHeaderText | Text (max 500) | No | — |
Composite indexes: (OrganisationId, Language, IX_OrgBrandingTranslations_OrgLang)
OrganisationRoles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
ApplicationRole | Text | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RoleName | Text | Yes | — |
OrganisationUserRoles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AssignedAt | Timestamp (UTC) | Yes | default now() |
IsActive | Boolean | Yes | — |
IsRevoked | Boolean | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RoleId | Integer | Yes | FK → OrganisationRoles (on delete: Cascade) |
UserId | Text (max 450) | Yes | FK → AspNetUsers (on delete: Cascade) |
Composite indexes: (UserId, OrganisationId, IX_OrgUserRoles_UserOrgRole)
OrgInvitations
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AcceptedAt | Timestamp (UTC) | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DepartmentId | UUID | No | — |
Email | Text (max 254) | Yes | — |
ExpiresAt | Timestamp (UTC) | Yes | — |
InvitedByUserId | Text (max 450) | Yes | — |
IsAccepted | Boolean | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RoleId | Integer | Yes | FK → OrganisationRoles (on delete: Cascade) |
Token | Text (max 100) | Yes | — |
Composite indexes: (Token, IX_OrgInvitations_Token), (OrganisationId, Email, IX_OrgInvitations_OrgEmail)
SsoConfigurations
| Column | Type | Required | Notes |
|---|---|---|---|
OrganisationId | UUID | Yes | PK |
Authority | Text (max 500) | No | — |
ClientId | Text (max 200) | No | — |
ClientSecret | Text (max 500) | No | — |
DisplayName | Text (max 100) | No | — |
Enabled | Boolean | Yes | — |
RequireSso | Boolean | Yes | Refuses password sign-in for every member of this organisation, leaving the identity provider as the only way in |
Scopes | Text (max 500) | Yes | — |
DomainVerifications
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CloudflareHostnameId | Text (max 100) | Yes | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Domain | Text (max 200) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
OwnershipVerificationName | Text (max 300) | No | — |
OwnershipVerificationValue | Text (max 500) | No | — |
SslStatus | Text (max 50) | No | — |
Status | Text | Yes | — |
VerifiedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, Domain)
AspNetUsers
| Column | Type | Required | Notes |
|---|---|---|---|
Id | Text | No | PK |
AccessFailedCount | Integer | Yes | — |
ConcurrencyStamp | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Email | Text (max 256) | No | — |
EmailConfirmed | Boolean | Yes | — |
FirstName | Text | No | — |
LastLoginAt | Timestamp (UTC) | No | — |
LastName | Text | No | — |
LockoutEnabled | Boolean | Yes | — |
LockoutEnd | Timestamp (UTC) | No | — |
NormalizedEmail | Text (max 256) | No | — |
NormalizedUserName | Text (max 256) | No | — |
PasswordHash | Text | No | — |
PhoneNumber | Text | No | — |
PhoneNumberConfirmed | Boolean | Yes | — |
PreferredLanguage | Text (max 10) | Yes | — |
SecurityStamp | Text | No | — |
TwoFactorEnabled | Boolean | Yes | — |
UserName | Text (max 256) | No | — |
Composite indexes: (NormalizedEmail, EmailIndex), (NormalizedUserName, UserNameIndex)
AspNetRoles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | Text | No | PK |
ConcurrencyStamp | Text | No | — |
Name | Text (max 256) | No | — |
NormalizedName | Text (max 256) | No | — |
Composite indexes: (NormalizedName, RoleNameIndex)
AspNetUserRoles
| Column | Type | Required | Notes |
|---|---|---|---|
UserId | Text | No | PK |
RoleId | Text | No | PK |
AspNetUserClaims
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
ClaimType | Text | No | — |
ClaimValue | Text | No | — |
UserId | Text | Yes | — |
AspNetRoleClaims
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
ClaimType | Text | No | — |
ClaimValue | Text | No | — |
RoleId | Text | Yes | — |
AspNetUserLogins
| Column | Type | Required | Notes |
|---|---|---|---|
LoginProvider | Text | No | PK |
ProviderKey | Text | No | PK |
ProviderDisplayName | Text | No | — |
UserId | Text | Yes | — |
AspNetUserTokens
| Column | Type | Required | Notes |
|---|---|---|---|
UserId | Text | No | PK |
LoginProvider | Text | No | PK |
Name | Text | No | PK |
Value | Text | No | — |
Audit trails
AdminAuditLogs
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 1000) | Yes | — |
EntityId | Text (max 100) | No | — |
EntityType | Text (max 50) | Yes | Category, Department, Exemption, Template, RequestType, EmailPipeline, Role, User, Organisation, Sso |
EventType | Text (max 50) | Yes | Created, Updated, Deleted, Deactivated, Reactivated, Invited, Removed, RoleChanged, etc |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UserId | Text (max 450) | Yes | — |
UserName | Text (max 200) | Yes | — |
Composite indexes: (OrganisationId, CreatedAt, IX_AdminAuditLogs_OrgCreated), (UserId, CreatedAt, IX_AdminAuditLogs_UserCreated)
UserAccessLogs
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Email | Text (max 254) | No | — |
EventType | Text (max 50) | Yes | What happened |
FailureReason | Text (max 500) | No | — |
IpAddress | Text (max 45) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UserAgent | Text (max 500) | No | — |
UserId | Text | No | — |
UserName | Text (max 200) | No | — |
Composite indexes: (OrganisationId, CreatedAt, IX_UserAccessLogs_OrgCreated), (UserId, CreatedAt, IX_UserAccessLogs_UserCreated)
RecordAccessLogs
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AccessType | Text (max 20) | Yes | What was done: see RecordAccessType |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 500) | No | Human-readable subject — the file name, the report name, the case reference |
EntityId | Text (max 100) | No | Identifier of the thing itself — a file id, a report key |
EntityType | Text (max 50) | Yes | What kind of thing was reached: see RecordAccessEntity |
IpAddress | Text (max 64) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RequestId | UUID | No | The case the access concerned, where there is one |
UserAgent | Text (max 512) | No | — |
UserId | Text (max 450) | No | — |
UserName | Text (max 200) | No | — |
Composite indexes: (OrganisationId, CreatedAt, IX_RecordAccessLogs_OrgCreated), (RequestId, CreatedAt, IX_RecordAccessLogs_RequestCreated), (OrganisationId, UserId, CreatedAt, IX_RecordAccessLogs_OrgUserCreated), (OrganisationId, UserId, EntityType, EntityId, CreatedAt, IX_RecordAccessLogs_Dedup)
EmailLogs
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BodyHtml | Text | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Direction | Text (max 10) | Yes | — |
EmailType | Text (max 50) | No | — |
ErrorMessage | Text (max 2000) | No | — |
FromAddress | Text (max 254) | No | — |
OrganisationId | UUID | Yes | — |
PipelineId | UUID | No | FK → EmailPipelines (on delete: SetNull) |
RequestId | UUID | No | FK → Requests (on delete: NoAction) |
RequestMessageId | UUID | No | — |
SentAt | Timestamp (UTC) | No | — |
Status | Text (max 20) | No | — |
Subject | Text (max 500) | No | — |
ToAddress | Text (max 254) | No | — |
UserMailConnectionId | UUID | No | Set when the email was sent via a user's personal mail connection |
Public portal
Portals
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
IsDefault | Boolean | Yes | When true this portal is served for URLs that name no portal |
IsEnabled | Boolean | Yes | A disabled portal is not served publicly, so a link can be withdrawn without deleting it |
Name | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Slug | Text (max 60) | Yes | URL-safe identifier, unique within the organisation |
Composite indexes: (OrganisationId, IX_Portals_OrgDefault), (OrganisationId, Slug, IX_Portals_OrgSlug)
PortalRequestTypes
| Column | Type | Required | Notes |
|---|---|---|---|
PortalId | UUID | Yes | PK; FK → Portals (on delete: Cascade) |
RequestTypeId | Integer | Yes | PK; FK → RequestTypes (on delete: Cascade) |
OrganisationId | UUID | Yes | — |
Composite indexes: (RequestTypeId, OrganisationId)
StatusSubscribers
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ConfirmToken | Text (max 128) | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Email | Text (max 256) | Yes | — |
IsConfirmed | Boolean | Yes | — |
UnsubscribeToken | Text (max 128) | No | — |
Composite indexes: (Email, IX_StatusSubscribers_Email)
Reporting and dashboards
ReportDefinitions
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BuiltInKey | Text (max 50) | No | Which built-in report this row offers — one of All |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text | No | — |
Definition | JSON | No | The custom query, as JSON (ReportQuery) |
Description | Text (max 500) | No | — |
Kind | Text (max 20) | Yes | See ReportDefinitionKind |
Name | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
SortOrder | Integer | Yes | Order in the reports tab |
SystemKey | Text (max 50) | No | Set on the reports scaffolded with the organisation, so scaffolding twice cannot produce duplicates |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, SortOrder, IX_ReportDefinitions_OrgOrder), (OrganisationId, SystemKey, IX_ReportDefinitions_OrgSystemKey)
ReportDefinitionRoles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ReportDefinitionId | UUID | Yes | FK → ReportDefinitions (on delete: Cascade) |
RoleId | Integer | Yes | FK → OrganisationRoles (on delete: Cascade) |
Composite indexes: (ReportDefinitionId, RoleId, IX_ReportDefinitionRoles_Pair)
ReportSchedules
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text | No | — |
DayOfMonth | Integer | No | Day of the month for a monthly schedule, 1–28 |
DayOfWeek | Integer | No | Day of the week for a weekly schedule, DayOfWeek as an int (0 = Sunday) |
Enabled | Boolean | Yes | Off by default and off after any change that could not be validated |
Frequency | Text (max 20) | Yes | One of ReportScheduleFrequency |
HourLocal | Integer | Yes | Wall-clock hour, 0–23, in the notification time zone |
LastRunAt | Timestamp (UTC) | No | When the sweep last sent this schedule |
LastRunNote | Text (max 500) | No | Why the last run sent less than it should have, or nothing at all |
LastRunRecipientCount | Integer | No | Number of recipients the last run actually reached |
MinuteLocal | Integer | Yes | Wall-clock minute, 0–59 |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
ReportDefinitionId | UUID | Yes | FK → ReportDefinitions (on delete: Cascade) |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (ReportDefinitionId, IX_ReportSchedules_Definition), (OrganisationId, Enabled, IX_ReportSchedules_OrgEnabled)
ReportScheduleRecipients
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
ReportScheduleId | UUID | Yes | FK → ReportSchedules (on delete: Cascade) |
UserId | Text (max 450) | Yes | — |
Composite indexes: (ReportScheduleId, UserId, IX_ReportScheduleRecipients_Pair)
Dashboards
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
CreatedByUserId | Text | No | — |
Description | Text (max 500) | No | Shown under the name in the picker |
Name | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
SortOrder | Integer | Yes | Order in the sidebar |
SystemKey | Text (max 50) | No | Set on the dashboard scaffolded with the organisation (see SystemContent), which is the one users landed on before any of this existed |
UpdatedAt | Timestamp (UTC) | No | — |
Composite indexes: (OrganisationId, SortOrder, IX_Dashboards_OrgOrder), (OrganisationId, SystemKey, IX_Dashboards_OrgSystemKey)
DashboardWidgets
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
Column | Integer | Yes | — |
DashboardId | UUID | Yes | FK → Dashboards (on delete: Cascade) |
Height | Integer | Yes | — |
Row | Integer | Yes | — |
Settings | JSON | No | Widget-specific configuration as JSON — which saved report a report.embed panel runs, and whatever later widgets need |
Title | Text (max 100) | No | Replaces the widget's default heading |
WidgetKey | Text (max 60) | Yes | One of All |
Width | Integer | Yes | — |
Composite indexes: (DashboardId, Row, Column, IX_DashboardWidgets_Position)
DashboardRoles
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
DashboardId | UUID | Yes | FK → Dashboards (on delete: Cascade) |
RoleId | Integer | Yes | FK → OrganisationRoles (on delete: Cascade) |
Composite indexes: (DashboardId, RoleId, IX_DashboardRoles_Pair)
Retention, backup and erasure
DisposalReviews
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
DateReceived | Timestamp (UTC) | Yes | — |
DecidedAt | Timestamp (UTC) | No | — |
DecidedByUserId | Text | No | — |
DecidedByUserName | Text (max 200) | No | — |
DecisionNotes | Text (max 1000) | No | — |
DestroyedAt | Timestamp (UTC) | No | When the case was actually destroyed |
EligibilityReason | Text (max 20) | Yes | — |
EligibleFrom | Timestamp (UTC) | Yes | The date the case became eligible — the response date or the trashing date plus the retention period |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
ProposalReason | Text (max 1000) | No | — |
ProposedAt | Timestamp (UTC) | Yes | When the retention job raised this proposal |
ProposedByUserId | Text | No | Who put this case forward, where a person did |
ProposedByUserName | Text (max 200) | No | — |
ReferenceNumber | Text (max 50) | Yes | — |
RequestId | UUID | Yes | The case this proposal is about |
RequestTypeName | Text (max 200) | No | — |
RetainUntil | Timestamp (UTC) | No | For a retained case: the date it may be proposed again |
RetentionDays | Integer | Yes | The retention period, in days, that made this case eligible |
Status | Text | Yes | — |
Title | Text (max 500) | No | — |
Composite indexes: (OrganisationId, Status, IX_DisposalReviews_OrganisationStatus), (RequestId, Status, IX_DisposalReviews_RequestStatus)
OrganisationBackups
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BlobPath | Text (max 500) | Yes | Path within the backups container |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByName | Text (max 200) | No | — |
CreatedByUserId | Text | No | Null on a scheduled backup — nobody pressed anything |
ExpiresAt | Timestamp (UTC) | Yes | When this backup is deleted, archive and all |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RowCount | Integer | Yes | Rows across every table, for the listing |
SchemaVersion | Text (max 20) | Yes | Format of the archive |
SizeBytes | Integer (64-bit) | Yes | — |
TableCountsJson | Text | No | Row count per table, as JSON, so the listing can show what a backup holds |
Trigger | Text (max 20) | Yes | One of BackupTrigger |
Composite indexes: (OrganisationId, CreatedAt)
OrganisationErasures
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
CancelledAt | Timestamp (UTC) | No | — |
CancelledByName | Text (max 512) | No | — |
CancelledByUserId | Text | No | — |
CompletedAt | Timestamp (UTC) | No | — |
FailureMessage | Text | No | Why an erasure that became due did not finish |
FilesDeleted | Integer | Yes | Stored files destroyed — documents, attachments, backups, export archives, logos |
FilesFailed | Integer | Yes | Files the erasure could not remove from storage, if any |
ForeignReferencesRemoved | Integer | Yes | Case-assignment links another organisation still held against an account this erasure deleted, and which could not outlive it |
Manifest | JSON | No | Per-table row counts as JSON, in the order the tables were cleared |
OrganisationId | UUID | Yes | The organisation this concerns |
OrganisationName | Text (max 512) | Yes | The organisation's name as it stood when erasure was scheduled |
Reason | Text | No | Why the authority is leaving, if they said |
Reference | Text (max 32) | Yes | unique; Human-quotable identifier for the certificate, unique across the platform — the reference an authority puts in its own exit records and quotes back if it ever needs to |
RequestedAt | Timestamp (UTC) | Yes | — |
RequestedByEmail | Text | No | — |
RequestedByName | Text (max 512) | Yes | Name and email of the person who asked, copied at the time |
RequestedByUserId | Text | Yes | — |
RowsDeleted | Integer | Yes | Database rows destroyed, across every table |
ScheduledFor | Timestamp (UTC) | Yes | The instant erasure becomes due — RequestedAt plus GraceDays |
Status | Text | Yes | — |
UsersDeleted | Integer | Yes | Sign-in accounts destroyed: the people whose only membership was of this organisation |
Composite indexes: (OrganisationId, UX_OrganisationErasures_Scheduled), (Status, ScheduledFor, IX_OrganisationErasures_StatusScheduledFor)
DataPortabilityJobs
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
BackupId | UUID | No | The restore point a backup job produced |
BlobPath | Text (max 500) | No | Path within the exports container |
CompletedAt | Timestamp (UTC) | No | — |
CreatedAt | Timestamp (UTC) | Yes | — |
Error | Text | No | Why it failed, in terms the person who asked can act on |
ExpiresAt | Timestamp (UTC) | No | When the produced archive is deleted |
Format | Text (max 10) | No | CSV, JSON or XML |
IncludeFiles | Boolean | Yes | — |
Kind | Text (max 20) | Yes | One of DataJobKind |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RequestedByName | Text (max 200) | No | — |
RequestedByUserId | Text | No | — |
RowCount | Integer | Yes | — |
SizeBytes | Integer (64-bit) | Yes | — |
StartedAt | Timestamp (UTC) | No | — |
Status | Text (max 20) | Yes | One of DataJobStatus |
TablesJson | Text | No | Chosen tables as JSON, or null for all of them |
Composite indexes: (OrganisationId, CreatedAt), (Status, CreatedAt)
Integration and API
ApiTokens
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
ExpiresAt | Timestamp (UTC) | No | — |
LastUsedAt | Timestamp (UTC) | No | — |
Name | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Prefix | Text (max 16) | Yes | First characters of the token (e.g. "rvk_a1b2c3") for display/identification |
RevokedAt | Timestamp (UTC) | No | — |
TokenHash | Text (max 64) | Yes | unique; SHA-256 hex hash of the full token value |
ApiOAuthClients
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
ClientId | Text (max 64) | Yes | unique; The public identifier, quoted in configuration and safe to display |
ClientSecretHash | Text (max 64) | Yes | SHA-256 hex hash of the client secret |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
LastUsedAt | Timestamp (UTC) | No | — |
Name | Text (max 100) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
RevokedAt | Timestamp (UTC) | No | — |
ApiAccessTokens
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
ApiOAuthClientId | UUID | Yes | FK → ApiOAuthClients (on delete: Cascade) |
ExpiresAt | Timestamp (UTC) | Yes | — |
IssuedAt | Timestamp (UTC) | Yes | — |
OrganisationId | UUID | Yes | — |
TokenHash | Text (max 64) | Yes | unique |
WebhookSubscriptions
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK |
ConsecutiveFailures | Integer | Yes | Consecutive delivery failures; the subscription is auto-disabled once this passes a threshold |
CreatedAt | Timestamp (UTC) | Yes | — |
CreatedByUserId | Text | No | — |
CreatedByUserName | Text | No | — |
Events | Text (max 500) | Yes | Comma-separated event names ("request.created,request.closed,request.overdue") or "*" for all |
Format | Text | Yes | The body shape this endpoint receives |
IsActive | Boolean | Yes | — |
LastError | Text | No | — |
LastTriggeredAt | Timestamp (UTC) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Secret | Text (max 128) | Yes | HMAC signing secret; shown once at creation |
Url | Text (max 2000) | Yes | — |
EmailPipelines
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AuthMode | Text | Yes | How this pipeline authenticates to the mail server: |
ConsecutiveFailures | Integer | Yes | Number of consecutive IMAP connection/auth failures |
CreatedAt | Timestamp (UTC) | Yes | default now() |
FromAddress | Text (max 254) | Yes | — |
FromDisplayName | Text (max 200) | No | — |
ImapHost | Text (max 200) | No | — |
ImapPassword | Text (max 500) | No | — |
ImapPort | Integer | Yes | IMAP port, typically 993 (SSL/TLS) |
ImapUseTls | Boolean | Yes | Use SSL/TLS when connecting to IMAP |
ImapUsername | Text (max 200) | No | — |
InboundAddress | Text (max 254) | Yes | — |
IsDefault | Boolean | Yes | When multiple pipelines serve the same request type, this one is used for outbound email on requests that have no pipeline of their own (e.g. created via the public portal) |
IsEnabled | Boolean | Yes | Whether this pipeline is active |
LastPolledAt | Timestamp (UTC) | No | Timestamp of the last successful poll |
LastProcessedUid | Integer (64-bit) | Yes | UID of the last successfully processed email in the IMAP mailbox |
Name | Text (max 200) | Yes | — |
OAuthConnectedEmail | Text (max 254) | No | — |
OAuthProviderId | UUID | No | FK → MailOAuthProviders (on delete: SetNull); Org OAuth provider used when AuthMode = OAuth |
OAuthRefreshToken | Text (max 4000) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
PollingError | Text (max 500) | No | — |
PollingErrorAt | Timestamp (UTC) | No | Timestamp when the polling error was recorded |
PollingLockHolder | Text (max 100) | No | — |
PollingLockUntil | Timestamp (UTC) | No | When the current polling lock expires |
ReplyToAddress | Text (max 254) | No | — |
RequestTypeId | Integer | Yes | FK → RequestTypes (on delete: Cascade); Request type this pipeline routes inbound mail to |
SmtpHost | Text (max 200) | Yes | — |
SmtpPassword | Text (max 500) | No | — |
SmtpPort | Integer | Yes | SMTP port, typically 587 (STARTTLS) or 465 (SSL) |
SmtpUsername | Text (max 200) | Yes | — |
UseTls | Boolean | Yes | Use TLS/SSL when connecting |
Composite indexes: (OrganisationId, InboundAddress, IX_EmailPipelines_OrgInbound), (RequestTypeId, OrganisationId)
MailOAuthProviders
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AuthorizationEndpoint | Text (max 500) | No | — |
ClientId | Text (max 200) | Yes | — |
ClientSecret | Text (max 500) | No | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DisplayName | Text (max 200) | Yes | — |
ImapHost | Text (max 200) | No | — |
ImapPort | Integer | No | — |
IsEnabled | Boolean | Yes | — |
Kind | Text | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
Scopes | Text (max 1000) | No | — |
SmtpHost | Text (max 200) | No | — |
SmtpPort | Integer | No | — |
TenantId | Text (max 100) | No | — |
TokenEndpoint | Text (max 500) | No | — |
Composite indexes: (OrganisationId, IX_MailOAuthProviders_Org)
UserMailConnections
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AuthType | Text | Yes | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
DisplayName | Text (max 200) | No | — |
EmailAddress | Text (max 254) | Yes | — |
LastError | Text (max 500) | No | — |
LastVerifiedAt | Timestamp (UTC) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
ProviderId | UUID | No | FK → MailOAuthProviders (on delete: SetNull) |
RefreshToken | Text (max 4000) | No | — |
SmtpHost | Text (max 200) | No | — |
SmtpPassword | Text (max 500) | No | — |
SmtpPort | Integer | Yes | — |
SmtpUsername | Text (max 200) | No | — |
Status | Text (max 30) | Yes | — |
UseTls | Boolean | Yes | — |
UserId | Text (max 450) | Yes | FK → AspNetUsers (on delete: Cascade) |
Composite indexes: (OrganisationId, UserId, IX_UserMailConnections_OrgUser)
Subscription and billing
SubscriptionPlans
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
AiInputTokenLimitPerMonth | Integer | Yes | Monthly limit on AI generation input tokens (0 = unlimited) |
AiOutputTokenLimitPerMonth | Integer | Yes | Monthly limit on AI generation output tokens (0 = unlimited) |
DeletedAt | Timestamp (UTC) | No | — |
Description | Text (max 500) | Yes | — |
IsDeleted | Boolean | Yes | — |
MonthlyPricePence | Integer | Yes | — |
Name | Text (max 100) | Yes | — |
Order | Integer | Yes | — |
RequestLimitPerMonth | Integer | Yes | — |
StorageLimitBytes | Integer (64-bit) | Yes | 50 GB |
StripeMonthlyPriceId | Text (max 100) | Yes | — |
StripeYearlyPriceId | Text (max 100) | Yes | — |
TrialDays | Integer | Yes | — |
YearlyPricePence | Integer | Yes | — |
Invoices
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AmountDue | Integer | Yes | in pence |
AmountPaid | Integer | Yes | in pence |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Currency | Text (max 5) | Yes | — |
DueDate | Timestamp (UTC) | No | — |
HostedInvoiceUrl | Text (max 500) | No | — |
InvoicePdfUrl | Text (max 500) | No | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
PeriodEnd | Text (max 30) | No | — |
PeriodStart | Text (max 30) | No | — |
Status | Text (max 20) | Yes | draft, open, paid, void, uncollectible |
StripeInvoiceId | Text (max 100) | Yes | — |
Tax | Integer | Yes | in pence |
Composite indexes: (StripeInvoiceId, IX_Invoices_StripeId), (OrganisationId, CreatedAt, IX_Invoices_OrgCreated)
DpaAcceptances
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AcceptedAt | Timestamp (UTC) | Yes | default now() |
DpaVersion | Text (max 20) | Yes | — |
IpAddress | Text (max 45) | Yes | — |
OrganisationId | UUID | Yes | FK → Organisations (on delete: Cascade) |
UserId | Text (max 450) | Yes | — |
Composite indexes: (OrganisationId, DpaVersion, IX_DpaAcceptances_OrgVersion)
OrgAiTokenUsages
| Column | Type | Required | Notes |
|---|---|---|---|
OrganisationId | UUID | Yes | PK; FK → Organisations (on delete: Cascade) |
YearMonth | Date | Yes | PK; First day of the month this record covers, e.g. 2026-05-01 |
InputTokensUsed | Integer | Yes | — |
OutputTokensUsed | Integer | Yes | — |
UpdatedAt | Timestamp (UTC) | Yes | — |
Platform
BankHolidays
| Column | Type | Required | Notes |
|---|---|---|---|
Id | — | Yes | PK |
Date | Date | Yes | — |
Division | Text (max 30) | Yes | — |
Notes | Text (max 200) | No | — |
Title | Text (max 200) | Yes | — |
Composite indexes: (Division, Date, IX_BankHolidays_DivisionDate)
DistributedLocks
| Column | Type | Required | Notes |
|---|---|---|---|
Name | Text (max 100) | No | PK |
ExpiresAt | Timestamp (UTC) | No | When the lock expires and can be re-acquired by another instance |
Holder | Text (max 200) | No | — |
Version | xid | Yes | — |
Incidents
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
AffectedComponent | Text (max 100) | Yes | — |
CreatedAt | Timestamp (UTC) | Yes | default now() |
Description | Text (max 2000) | Yes | — |
ResolvedAt | Timestamp (UTC) | No | — |
Severity | Text | Yes | — |
Status | Text | Yes | — |
Title | Text (max 300) | Yes | — |
IncidentUpdates
| Column | Type | Required | Notes |
|---|---|---|---|
Id | UUID | Yes | PK; default gen_random_uuid() |
CreatedAt | Timestamp (UTC) | Yes | default now() |
IncidentId | UUID | Yes | FK → Incidents (on delete: Cascade) |
Message | Text (max 2000) | Yes | — |
Status | Text | Yes | — |