AutoMate Technisch Help

StatusPage — D1 Schema

De StatusPage Worker gebruikt een Cloudflare D1 SQLite-database (status-db, ID: 621faeef-715e-4d51-80cc-74f112560ce1). Het schema is gedefinieerd in Portals/StatusPage.Worker/migrations/0001_init.sql en bevat 11 tabellen.

Alle timestamp/datumkolommen zijn TEXT in ISO 8601 UTC-formaat (new Date().toISOString()). SQLite heeft geen native datetime-type; de applicatie schrijft en vergelijkt altijd in deze notatie.

Tabellen

Modules

Definieert de AutoMate-subsystemen die gemonitord worden.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

NameNl

TEXT

Nederlandse naam (bijv. "Identiteit")

NameEn

TEXT

Engelse naam (bijv. "Identity")

Description

TEXT

Optionele beschrijving

HealthEndpointPath

TEXT

Endpoint(s) die gepolld worden, kommagescheiden (bijv. /ping of /health/graph,/ping)

BaseUrl

TEXT

Optioneel: eigen base URL voor modules buiten de AutoMate.API-tunnel

ApiKeyHeader/ApiKeyValue

TEXT

Optionele API-key voor authenticatie bij het poll-endpoint

DisplayOrder

INTEGER

Weergavevolgorde op de publieke pagina

IsActive

INTEGER

1 = actief, 0 = uitgeschakeld (niet gepolld)

CreatedAt

TEXT

ISO 8601 UTC aanmaakdatum

Geschreven door: admin-interface (/admin/modules). De seed in de migratie vult vier standaardmodules.

HealthRecords

Bevat het resultaat van elke individuele poll-aanroep.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

ModuleId

INTEGER FK → Modules

Welke module

Status

TEXT

Healthy, Degraded of Unhealthy

ResponseTimeMs

INTEGER

Responsetijd in milliseconden

Details

TEXT

Foutmelding bij niet-Healthy status

CheckedAt

TEXT

ISO 8601 UTC tijdstip van poll

Indexen:

  • IX_HealthRecords_CheckedAt — snel snijden op tijdvenster voor pruning

  • IX_HealthRecords_ModuleId_CheckedAt — snel ophalen meest recente record per module

Geschreven door: cron trigger (elke minuut via runHealthPoll()).
Retentie: 90 dagen. Records ouder dan 90 dagen worden door de uurlijkse cron verwijderd via pruneOldHealthRecords().

UptimeSummaries

Dagelijkse aggregaten per module voor de 90-dagen timeline op de publieke pagina.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

ModuleId

INTEGER FK → Modules

Welke module

Date

TEXT

yyyy-MM-dd

TotalChecks

INTEGER

Totaal aantal polls die dag

HealthyChecks

INTEGER

Aantal Healthy polls

DegradedChecks

INTEGER

Aantal Degraded polls

UnhealthyChecks

INTEGER

Aantal Unhealthy polls

WorstStatus

TEXT

Slechtste status die dag

Unieke index: UX_UptimeSummaries_ModuleId_DateINSERT … ON CONFLICT DO UPDATE (upsert) bij elke rollup.

Geschreven door: rollUpDailySummaries() — elke minuut en elk uur via cron.

Incidents

Handmatig aangemaakte incidenten door admins.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

TitleNl/TitleEn

TEXT

Tweetalige incidenttitel

DescriptionNl/DescriptionEn

TEXT

Optionele tweetalige omschrijving

Severity

TEXT

Minor \|Major \|Critical

Status

TEXT

Investigating \|Identified \|Monitoring \|Resolved

StartedAt

TEXT

ISO 8601 UTC begin van het incident

ResolvedAt

TEXT

ISO 8601 UTC tijdstip van oplossing (NULL als nog actief)

CreatedAt

TEXT

ISO 8601 UTC aanmaakdatum

Indexen:

  • IX_Incidents_StartedAt — voor gesorteerde queries (history pagina, maandoverzicht)

  • IX_Incidents_Status — voor de WHERE Status != 'Resolved'-query van getActiveIncidents()

Geschreven door: admin-interface (/admin/incidents).

IncidentUpdates

Chronologische updates binnen een incident.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

IncidentId

INTEGER FK → Incidents (CASCADE DELETE)

Welk incident

MessageNl/MessageEn

TEXT

Tweetalige update-tekst

Status

TEXT

Incidentstatus op moment van update

CreatedAt

TEXT

ISO 8601 UTC

Geschreven door: addIncidentUpdate() — ook werkt de moeder-Incidents-rij bij naar de nieuwe status.

ModuleIncidents

Koppeltabel: meerdere modules per incident, meerdere incidenten per module.

Kolom

Type

Beschrijving

ModuleId

INTEGER FK → Modules

Betrokken module

IncidentId

INTEGER FK → Incidents (CASCADE DELETE)

Betrokken incident

Composite primary key (ModuleId, IncidentId).

MaintenanceWindows

Gepland onderhoud dat de health-poller pauzeert.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

MessageNl/MessageEn

TEXT

Tweetalig onderhoudsberichte

IsActive

INTEGER

1 = actief maintenance window

StartedAt

TEXT

ISO 8601 UTC begin

EndedAt

TEXT

ISO 8601 UTC einde (NULL als nog actief)

Index: IX_MaintenanceWindows_IsActive — snel opvragen actief window.

Geschreven door: admin-interface (start/stop maintenance). Er kan maximaal één actief window tegelijk bestaan; startMaintenance() eindigt een eventueel bestaand actief window eerst.

Responders

On-call medewerkers voor notificaties.

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

Name

TEXT

Naam van de medewerker

PhoneNumber

TEXT

WhatsApp-nummer

Email

TEXT

Optioneel e-mailadres

Notes

TEXT

Vrij tekstnotities

IsActive

INTEGER

1 = actief, ontvangt notificaties

CreatedAt

TEXT

ISO 8601 UTC

AlertEvents

Inkomende alertgebeurtenissen (bijv. gegenereerd door de health-poller of externe webhooks).

Kolom

Type

Beschrijving

Id

INTEGER PK

Auto-increment

ModuleName

TEXT

Naam van de betrokken module

Severity

TEXT

Standaard Warning

Status

TEXT

Triggered \|Claimed \|Resolved

Message

TEXT

Optionele omschrijving

ClaimedByResponderId

INTEGER FK → Responders (SET NULL)

Wie het event heeft geclaimd

ClaimedByResponderName

TEXT

Naam ten tijde van claimering (denormalisatie)

ClaimedAt

TEXT

ISO 8601 UTC

ResolvedAt

TEXT

ISO 8601 UTC

NotificationSent

INTEGER

1 zodra de WhatsApp-notificatie verzonden is

CreatedAt

TEXT

ISO 8601 UTC

ActiveLock

TEXT

Deduplicatietoken; UNIQUE WHERE NOT NULL

Indexen: op Status, (ModuleName, Status) en CreatedAt.
UX_AlertEvents_ActiveLock (partial unique) voorkomt dubbele alerts voor dezelfde situatie.

Sessions

KV is de primaire sessie-opslag; deze tabel bestaat als optie maar wordt in productie niet gebruikt.

Kolom

Type

Beschrijving

Id

TEXT PK

Willekeurige session UUID

UserId

TEXT

oid-claim uit Entra ID-token

Email/DisplayName

TEXT

Gebruikersgegevens

CreatedAt/ExpiresAt

TEXT

ISO 8601 UTC

Settings

Generieke key-value store voor runtime-instellingen.

Kolom

Type

Beschrijving

Key

TEXT PK

Instellingsnaam

Value

TEXT

Waarde

UpdatedAt

TEXT

ISO 8601 UTC

Voorbeeldgebruik: maintenance-toggle, Twilio template-overrides.

Relatiediagram

1..n

1..n

n..m via

n..m

1..n CASCADE

CASCADE

0..n SET NULL

Modules

HealthRecords

UptimeSummaries

ModuleIncidents

Incidents

IncidentUpdates

Responders

AlertEvents

MaintenanceWindows

Settings

Sessions

Migratiebeheer

Migraties staan in Portals/StatusPage.Worker/migrations/. De migratie-directory is geconfigureerd in wrangler.jsonc onder d1_databases[].migrations_dir.

Migraties applyen:

# Lokaal pnpm exec wrangler d1 migrations apply status-db --local # Remote productie pnpm exec wrangler d1 migrations apply status-db --remote # Remote development environment pnpm exec wrangler d1 migrations apply status-db --remote --env development

De CI-workflow (Deployment-StatusPage-Worker.yml) past migraties automatisch toe voor de deploy-stap.

Last modified: 25 June 2026