ModelRouterService — 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.ModelProfiles¶
Owner: ModelProfile
CREATE TABLE [dbo].[ModelProfiles] (
[ProfileId] nvarchar(64) NOT NULL,
[Version] nvarchar(32) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ReleaseId] nvarchar(256) NOT NULL,
[Modality] int NOT NULL,
[RequiredCapabilitiesJson] nvarchar(max) NOT NULL,
[PrivacyClass] int NOT NULL,
[LatencyClass] int NOT NULL,
[MaxContextTokens] int NOT NULL,
[MaxOutputTokens] int NOT NULL,
[AllowedRegionsJson] nvarchar(512) NOT NULL,
[AllowedDeploymentsJson] nvarchar(2000) NOT NULL,
[FallbackChainJson] nvarchar(512) NOT NULL,
[FallbackEnabled] bit NOT NULL DEFAULT (0),
[EmbeddingCompatibility] nvarchar(64) NULL,
[PriceBasis] nvarchar(32) NOT NULL,
[Active] bit NOT NULL DEFAULT (1),
CONSTRAINT [PK_ModelProfiles] PRIMARY KEY ([ProfileId], [Version])
);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
ProfileId |
nvarchar(64) |
no | PK | |
Version |
nvarchar(32) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
ReleaseId |
nvarchar(256) |
no | ||
Modality |
int |
no | ||
RequiredCapabilitiesJson |
nvarchar(max) |
no | ||
PrivacyClass |
int |
no | ||
LatencyClass |
int |
no | ||
MaxContextTokens |
int |
no | ||
MaxOutputTokens |
int |
no | ||
AllowedRegionsJson |
nvarchar(512) |
no | ||
AllowedDeploymentsJson |
nvarchar(2000) |
no | ||
FallbackChainJson |
nvarchar(512) |
no | ||
FallbackEnabled |
bit |
no | ||
EmbeddingCompatibility |
nvarchar(64) |
yes | ||
PriceBasis |
nvarchar(32) |
no | ||
Active |
bit |
no |
dbo.ModelDeployments¶
Owner: ModelDeployment
CREATE TABLE [dbo].[ModelDeployments] (
[DeploymentId] nvarchar(128) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Provider] nvarchar(32) NOT NULL,
[Model] nvarchar(128) NOT NULL,
[Region] nvarchar(32) NOT NULL,
[PrivacyClass] int NOT NULL,
[EndpointRef] nvarchar(512) NOT NULL,
[ComputePoolId] nvarchar(64) NULL,
[CapabilityEvidenceRef] nvarchar(512) NULL,
[LicenseMetadataJson] nvarchar(2000) NOT NULL,
[State] int NOT NULL,
[Healthy] bit NOT NULL DEFAULT (1),
[Version] rowversion NOT NULL,
CONSTRAINT [PK_ModelDeployments] PRIMARY KEY ([DeploymentId])
);
CREATE INDEX [IX_Deployments_Provider_Region] ON [dbo].[ModelDeployments] ([TenantId], [Provider], [Region], [State]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
DeploymentId |
nvarchar(128) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
Provider |
nvarchar(32) |
no | ||
Model |
nvarchar(128) |
no | ||
Region |
nvarchar(32) |
no | ||
PrivacyClass |
int |
no | ||
EndpointRef |
nvarchar(512) |
no | ||
ComputePoolId |
nvarchar(64) |
yes | ||
CapabilityEvidenceRef |
nvarchar(512) |
yes | ||
LicenseMetadataJson |
nvarchar(2000) |
no | ||
State |
int |
no | ||
Healthy |
bit |
no | ||
Version |
rowversion |
no |
dbo.CapabilityScores¶
Owner: CapabilityScore
CREATE TABLE [dbo].[CapabilityScores] (
[DeploymentId] nvarchar(128) NOT NULL,
[Capability] nvarchar(64) NOT NULL,
[SuiteVersion] nvarchar(32) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Verdict] nvarchar(8) NOT NULL,
[Score] decimal(6,4) NULL,
[EvaluatedAt] datetimeoffset NOT NULL,
CONSTRAINT [PK_CapabilityScores] PRIMARY KEY ([DeploymentId], [Capability], [SuiteVersion])
);
ALTER TABLE [dbo].[CapabilityScores] ADD CONSTRAINT [FK_CapabilityScores_ModelDeployments_DeploymentId] FOREIGN KEY ([DeploymentId]) REFERENCES [dbo].[ModelDeployments] ([DeploymentId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
DeploymentId |
nvarchar(128) |
no | PK FK → ModelDeployments.DeploymentId | |
Capability |
nvarchar(64) |
no | PK | |
SuiteVersion |
nvarchar(32) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
Verdict |
nvarchar(8) |
no | ||
Score |
decimal(6,4) |
yes | ||
EvaluatedAt |
datetimeoffset |
no |
dbo.RoutePlans¶
Owner: RoutePlan
CREATE TABLE [dbo].[RoutePlans] (
[RoutePlanId] uniqueidentifier NOT NULL,
[RunId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ProfileId] nvarchar(64) NOT NULL,
[ProfileVersion] nvarchar(32) NOT NULL,
[PolicyRevision] nvarchar(64) NOT NULL,
[CandidatesJson] nvarchar(2000) NOT NULL,
[ConstraintsJson] nvarchar(2000) NOT NULL,
[ResolvedAt] datetimeoffset NOT NULL,
CONSTRAINT [PK_RoutePlans] PRIMARY KEY ([RoutePlanId])
);
CREATE UNIQUE INDEX [UX_RoutePlans_Run_Profile] ON [dbo].[RoutePlans] ([RunId], [ProfileId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
RoutePlanId |
uniqueidentifier |
no | PK | |
RunId |
uniqueidentifier |
no | ||
TenantId |
nvarchar(64) |
no | ||
ProfileId |
nvarchar(64) |
no | ||
ProfileVersion |
nvarchar(32) |
no | ||
PolicyRevision |
nvarchar(64) |
no | ||
CandidatesJson |
nvarchar(2000) |
no | ||
ConstraintsJson |
nvarchar(2000) |
no | ||
ResolvedAt |
datetimeoffset |
no |
dbo.InvocationReceipts¶
Owner: InvocationReceipt · Retention: 1 year by default (D31); receipts referenced by audit evidence are kept 7 years
CREATE TABLE [dbo].[InvocationReceipts] (
[InvocationId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ProjectId] nvarchar(64) NOT NULL,
[RunId] uniqueidentifier NULL,
[AttemptId] uniqueidentifier NULL,
[ProfileId] nvarchar(64) NOT NULL,
[DeploymentId] nvarchar(128) NOT NULL,
[RoutePlanId] uniqueidentifier NULL,
[FallbackUsed] bit NOT NULL DEFAULT (0),
[RequestHash] nvarchar(128) NOT NULL,
[IdempotencyKey] nvarchar(128) NOT NULL,
[PolicyDecisionId] uniqueidentifier NOT NULL,
[Outcome] int NOT NULL,
[UsageStatus] int NOT NULL,
[InputTokens] int NULL,
[OutputTokens] int NULL,
[EstimatedCostUsd] decimal(18,6) NULL,
[PricingRevision] nvarchar(32) NOT NULL,
[LatencyMs] int NULL,
[OutputArtifactRef] nvarchar(512) NULL,
[StartedAt] datetimeoffset NOT NULL,
[EndedAt] datetimeoffset NULL,
CONSTRAINT [PK_InvocationReceipts] PRIMARY KEY ([InvocationId])
);
CREATE UNIQUE INDEX [UX_Receipts_Scope_Idempotency] ON [dbo].[InvocationReceipts] ([TenantId], [ProjectId], [IdempotencyKey]);
CREATE INDEX [IX_Receipts_Run] ON [dbo].[InvocationReceipts] ([RunId], [AttemptId]);
CREATE INDEX [IX_Receipts_Tenant_StartedAt] ON [dbo].[InvocationReceipts] ([TenantId], [StartedAt]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
InvocationId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
ProjectId |
nvarchar(64) |
no | ||
RunId |
uniqueidentifier |
yes | ||
AttemptId |
uniqueidentifier |
yes | ||
ProfileId |
nvarchar(64) |
no | ||
DeploymentId |
nvarchar(128) |
no | ||
RoutePlanId |
uniqueidentifier |
yes | ||
FallbackUsed |
bit |
no | ||
RequestHash |
nvarchar(128) |
no | ||
IdempotencyKey |
nvarchar(128) |
no | ||
PolicyDecisionId |
uniqueidentifier |
no | ||
Outcome |
int |
no | ||
UsageStatus |
int |
no | ||
InputTokens |
int |
yes | ||
OutputTokens |
int |
yes | ||
EstimatedCostUsd |
decimal(18,6) |
yes | ||
PricingRevision |
nvarchar(32) |
no | ||
LatencyMs |
int |
yes | ||
OutputArtifactRef |
nvarchar(512) |
yes | ||
StartedAt |
datetimeoffset |
no | ||
EndedAt |
datetimeoffset |
yes |