Skip to content

RuntimeEnvironmentService — 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.RuntimeInventories

Owner: RuntimeInventory

CREATE TABLE [dbo].[RuntimeInventories] (
    [EnvironmentId] nvarchar(64) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [CurrentReleaseId] uniqueidentifier NULL,
    [SpecificationVersion] int NULL,
    [ObservedAt] datetimeoffset NOT NULL,
    [Stale] bit NOT NULL DEFAULT (0),
    CONSTRAINT [PK_RuntimeInventories] PRIMARY KEY ([EnvironmentId])
);
Column Type Null Key Description
EnvironmentId nvarchar(64) no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
CurrentReleaseId uniqueidentifier yes
SpecificationVersion int yes
ObservedAt datetimeoffset no
Stale bit no

dbo.ObservedWorkloads

Owner: ObservedWorkload

CREATE TABLE [dbo].[ObservedWorkloads] (
    [EnvironmentId] nvarchar(64) NOT NULL,
    [Name] nvarchar(128) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Kind] int NOT NULL,
    [Version] nvarchar(128) NOT NULL,
    [ReplicasReady] int NOT NULL,
    [ReplicasDesired] int NOT NULL,
    [EndpointsJson] nvarchar(1024) NOT NULL,
    [ConfigRefsJson] nvarchar(2000) NOT NULL,
    [SecretRefsJson] nvarchar(2000) NOT NULL,
    [Health] nvarchar(16) NOT NULL,
    CONSTRAINT [PK_ObservedWorkloads] PRIMARY KEY ([EnvironmentId], [Name])
);
ALTER TABLE [dbo].[ObservedWorkloads] ADD CONSTRAINT [FK_ObservedWorkloads_RuntimeInventories_EnvironmentId] FOREIGN KEY ([EnvironmentId]) REFERENCES [dbo].[RuntimeInventories] ([EnvironmentId]);
Column Type Null Key Description
EnvironmentId nvarchar(64) no PK FK → RuntimeInventories.EnvironmentId
Name nvarchar(128) no PK
TenantId nvarchar(64) no
Kind int no
Version nvarchar(128) no
ReplicasReady int no
ReplicasDesired int no
EndpointsJson nvarchar(1024) no
ConfigRefsJson nvarchar(2000) no
SecretRefsJson nvarchar(2000) no
Health nvarchar(16) no

dbo.DriftFindings

Owner: DriftFinding · Retention: 13 months

CREATE TABLE [dbo].[DriftFindings] (
    [FindingId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [EnvironmentId] nvarchar(64) NOT NULL,
    [Kind] int NOT NULL,
    [Resource] nvarchar(256) NOT NULL,
    [DeclaredJson] nvarchar(2000) NULL,
    [ObservedJson] nvarchar(2000) NULL,
    [DetectedAt] datetimeoffset NOT NULL,
    [ProposalId] uniqueidentifier NULL,
    [ResolvedAt] datetimeoffset NULL,
    CONSTRAINT [PK_DriftFindings] PRIMARY KEY ([FindingId])
);
CREATE INDEX [IX_Drift_Env_Open] ON [dbo].[DriftFindings] ([TenantId], [EnvironmentId], [ResolvedAt]);
Column Type Null Key Description
FindingId uniqueidentifier no PK
TenantId nvarchar(64) no
EnvironmentId nvarchar(64) no
Kind int no
Resource nvarchar(256) no
DeclaredJson nvarchar(2000) yes
ObservedJson nvarchar(2000) yes
DetectedAt datetimeoffset no
ProposalId uniqueidentifier yes
ResolvedAt datetimeoffset yes

dbo.ReconciliationProposals

Owner: ReconciliationProposal

CREATE TABLE [dbo].[ReconciliationProposals] (
    [ProposalId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [EnvironmentId] nvarchar(64) NOT NULL,
    [FindingIdsJson] nvarchar(max) NOT NULL,
    [Direction] nvarchar(16) NOT NULL,
    [PlanSummaryJson] nvarchar(max) NOT NULL,
    [Destructive] bit NOT NULL,
    [State] int NOT NULL,
    [DecidedBy] nvarchar(256) NULL,
    [ProvisioningRunId] uniqueidentifier NULL,
    [RaisedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_ReconciliationProposals] PRIMARY KEY ([ProposalId])
);
CREATE INDEX [IX_Reconcile_Env_State] ON [dbo].[ReconciliationProposals] ([TenantId], [EnvironmentId], [State]);
Column Type Null Key Description
ProposalId uniqueidentifier no PK
TenantId nvarchar(64) no
EnvironmentId nvarchar(64) no
FindingIdsJson nvarchar(max) no
Direction nvarchar(16) no
PlanSummaryJson nvarchar(max) no
Destructive bit no
State int no
DecidedBy nvarchar(256) yes
ProvisioningRunId uniqueidentifier yes
RaisedAt datetimeoffset no