Skip to content

SloService — DDL appendix

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

Dialect shown: SQL Server (nvarchar, uniqueidentifier, datetimeoffset). Migrations are authored as FluentMigrator classes in the service's DatabaseModel.Migrations project; the TenantId column and the NHibernate tenant filter follow canonical ADR-0100 in SharedDb mode.

dbo.SloDefinitions

Owner: SloDefinition

CREATE TABLE [dbo].[SloDefinitions] (
    [SloId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SubjectKind] nvarchar(16) NOT NULL,
    [SubjectId] nvarchar(128) NOT NULL,
    [Kind] int NOT NULL,
    [Target] decimal(12,6) NOT NULL,
    [Window] nvarchar(16) NOT NULL,
    [BurnAlertThresholdsJson] nvarchar(256) NOT NULL,
    [Source] nvarchar(256) NOT NULL,
    [Active] bit NOT NULL DEFAULT (1),
    CONSTRAINT [PK_SloDefinitions] PRIMARY KEY ([SloId])
);
CREATE UNIQUE INDEX [UX_Slo_Subject_Kind] ON [dbo].[SloDefinitions] ([TenantId], [SubjectKind], [SubjectId], [Kind]);
Column Type Null Key Description
SloId uniqueidentifier no PK
TenantId nvarchar(64) no
SubjectKind nvarchar(16) no
SubjectId nvarchar(128) no
Kind int no
Target decimal(12,6) no
Window nvarchar(16) no
BurnAlertThresholdsJson nvarchar(256) no
Source nvarchar(256) no
Active bit no

dbo.SloMeasurements

Owner: SloMeasurement · Retention: 13 months

CREATE TABLE [dbo].[SloMeasurements] (
    [SloId] uniqueidentifier NOT NULL,
    [MeasuredAt] datetimeoffset NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Value] decimal(12,6) NOT NULL,
    [ErrorBudgetRemaining] decimal(12,6) NOT NULL,
    [BurnRate] decimal(12,6) NOT NULL,
    [State] int NOT NULL,
    CONSTRAINT [PK_SloMeasurements] PRIMARY KEY ([SloId], [MeasuredAt])
);
ALTER TABLE [dbo].[SloMeasurements] ADD CONSTRAINT [FK_SloMeasurements_SloDefinitions_SloId] FOREIGN KEY ([SloId]) REFERENCES [dbo].[SloDefinitions] ([SloId]);
Column Type Null Key Description
SloId uniqueidentifier no PK FK → SloDefinitions.SloId
MeasuredAt datetimeoffset no PK
TenantId nvarchar(64) no
Value decimal(12,6) no
ErrorBudgetRemaining decimal(12,6) no
BurnRate decimal(12,6) no
State int no

dbo.ServiceHealth

Owner: ServiceHealth

CREATE TABLE [dbo].[ServiceHealth] (
    [HostId] nvarchar(64) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [State] int NOT NULL,
    [DependenciesJson] nvarchar(2000) NOT NULL,
    [ReplicasReady] int NOT NULL,
    [ObservedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_ServiceHealth] PRIMARY KEY ([HostId])
);
Column Type Null Key Description
HostId nvarchar(64) no PK
TenantId nvarchar(64) no
State int no
DependenciesJson nvarchar(2000) no
ReplicasReady int no
ObservedAt datetimeoffset no