Skip to content

QualityScoreService — 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.EvaluationSuites

Owner: EvaluationSuite

CREATE TABLE [dbo].[EvaluationSuites] (
    [SuiteId] nvarchar(128) NOT NULL,
    [Version] nvarchar(32) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ReleaseId] nvarchar(256) NOT NULL,
    [Target] int NOT NULL,
    [DatasetId] uniqueidentifier NOT NULL,
    [MetricsJson] nvarchar(max) NOT NULL,
    [BaselineRuleJson] nvarchar(1024) NOT NULL,
    [BudgetsJson] nvarchar(256) NOT NULL,
    [Active] bit NOT NULL DEFAULT (1),
    CONSTRAINT [PK_EvaluationSuites] PRIMARY KEY ([SuiteId], [Version])
);
Column Type Null Key Description
SuiteId nvarchar(128) no PK
Version nvarchar(32) no PK
TenantId nvarchar(64) no
ReleaseId nvarchar(256) no
Target int no
DatasetId uniqueidentifier no
MetricsJson nvarchar(max) no
BaselineRuleJson nvarchar(1024) no
BudgetsJson nvarchar(256) no
Active bit no

dbo.EvaluationRuns

Owner: EvaluationRun · Retention: 7 years for evidence references; results 2 years

CREATE TABLE [dbo].[EvaluationRuns] (
    [EvaluationId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SuiteId] nvarchar(128) NOT NULL,
    [SuiteVersion] nvarchar(32) NOT NULL,
    [TargetReleaseId] nvarchar(256) NOT NULL,
    [BaselineReleaseId] nvarchar(256) NULL,
    [DatasetSnapshotRef] nvarchar(512) NOT NULL,
    [State] int NOT NULL,
    [ResultsJson] nvarchar(max) NULL,
    [Verdict] int NULL,
    [WaiverApprovalId] uniqueidentifier NULL,
    [CostUsd] decimal(18,6) NULL,
    [DurationMs] bigint NULL,
    [EvidenceRef] nvarchar(512) NULL,
    [StartedAt] datetimeoffset NOT NULL,
    [CompletedAt] datetimeoffset NULL,
    CONSTRAINT [PK_EvaluationRuns] PRIMARY KEY ([EvaluationId])
);
CREATE INDEX [IX_Evaluations_Target] ON [dbo].[EvaluationRuns] ([TenantId], [TargetReleaseId], [State]);
Column Type Null Key Description
EvaluationId uniqueidentifier no PK
TenantId nvarchar(64) no
SuiteId nvarchar(128) no
SuiteVersion nvarchar(32) no
TargetReleaseId nvarchar(256) no
BaselineReleaseId nvarchar(256) yes
DatasetSnapshotRef nvarchar(512) no
State int no
ResultsJson nvarchar(max) yes
Verdict int yes
WaiverApprovalId uniqueidentifier yes
CostUsd decimal(18,6) yes
DurationMs bigint yes
EvidenceRef nvarchar(512) yes
StartedAt datetimeoffset no
CompletedAt datetimeoffset yes

dbo.EvaluationResults

Owner: EvaluationRun

CREATE TABLE [dbo].[EvaluationResults] (
    [EvaluationId] uniqueidentifier NOT NULL,
    [TaskId] nvarchar(128) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [RunId] uniqueidentifier NOT NULL,
    [MetricsJson] nvarchar(2000) NOT NULL,
    [Passed] bit NOT NULL,
    CONSTRAINT [PK_EvaluationResults] PRIMARY KEY ([EvaluationId], [TaskId])
);
ALTER TABLE [dbo].[EvaluationResults] ADD CONSTRAINT [FK_EvaluationResults_EvaluationRuns_EvaluationId] FOREIGN KEY ([EvaluationId]) REFERENCES [dbo].[EvaluationRuns] ([EvaluationId]);
Column Type Null Key Description
EvaluationId uniqueidentifier no PK FK → EvaluationRuns.EvaluationId
TaskId nvarchar(128) no PK
TenantId nvarchar(64) no
RunId uniqueidentifier no The Factory run that executed the task.
MetricsJson nvarchar(2000) no
Passed bit no