Skip to content

BlueprintService — 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.BlueprintVersions

Owner: BlueprintVersion

CREATE TABLE [dbo].[BlueprintVersions] (
    [BlueprintId] nvarchar(128) NOT NULL,
    [Version] nvarchar(32) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [Kind] int NOT NULL,
    [SchemaVersion] nvarchar(16) NOT NULL,
    [DocumentRef] nvarchar(512) NOT NULL,
    [DocumentHash] nvarchar(128) NOT NULL,
    [State] int NOT NULL,
    [ValidationReportRef] nvarchar(512) NULL,
    [ContextMapRef] nvarchar(512) NULL,
    [DomainModelRef] nvarchar(512) NULL,
    [ReleaseId] nvarchar(256) NULL,
    [AuthoredBy] nvarchar(256) NOT NULL,
    [CreatedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_BlueprintVersions] PRIMARY KEY ([BlueprintId], [Version])
);
CREATE INDEX [IX_Blueprints_Project_Kind] ON [dbo].[BlueprintVersions] ([TenantId], [ProjectId], [Kind], [State]);
Column Type Null Key Description
BlueprintId nvarchar(128) no PK
Version nvarchar(32) no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
Kind int no
SchemaVersion nvarchar(16) no
DocumentRef nvarchar(512) no
DocumentHash nvarchar(128) no
State int no
ValidationReportRef nvarchar(512) yes
ContextMapRef nvarchar(512) yes
DomainModelRef nvarchar(512) yes
ReleaseId nvarchar(256) yes
AuthoredBy nvarchar(256) no
CreatedAt datetimeoffset no

dbo.ValidationFindings

Owner: ValidationFinding

CREATE TABLE [dbo].[ValidationFindings] (
    [BlueprintId] nvarchar(128) NOT NULL,
    [Version] nvarchar(32) NOT NULL,
    [Sequence] int NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [RuleId] nvarchar(64) NOT NULL,
    [Severity] nvarchar(8) NOT NULL,
    [Path] nvarchar(512) NOT NULL,
    [Message] nvarchar(1024) NOT NULL,
    CONSTRAINT [PK_ValidationFindings] PRIMARY KEY ([BlueprintId], [Version], [Sequence])
);
ALTER TABLE [dbo].[ValidationFindings] ADD CONSTRAINT [FK_ValidationFindings_BlueprintVersions_BlueprintId] FOREIGN KEY ([BlueprintId]) REFERENCES [dbo].[BlueprintVersions] ([BlueprintId]);
Column Type Null Key Description
BlueprintId nvarchar(128) no PK FK → BlueprintVersions.BlueprintId
Version nvarchar(32) no PK
Sequence int no PK
TenantId nvarchar(64) no
RuleId nvarchar(64) no
Severity nvarchar(8) no
Path nvarchar(512) no
Message nvarchar(1024) no

dbo.ContextMaps

Owner: ContextMap

CREATE TABLE [dbo].[ContextMaps] (
    [ContextMapId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [BlueprintId] nvarchar(128) NOT NULL,
    [BlueprintVersion] nvarchar(32) NOT NULL,
    [ContextsJson] nvarchar(max) NOT NULL,
    [RelationshipsJson] nvarchar(max) NOT NULL,
    [PublishedEventsJson] nvarchar(max) NOT NULL,
    [DerivedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_ContextMaps] PRIMARY KEY ([ContextMapId])
);
CREATE UNIQUE INDEX [UX_ContextMaps_Blueprint] ON [dbo].[ContextMaps] ([BlueprintId], [BlueprintVersion]);
Column Type Null Key Description
ContextMapId uniqueidentifier no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
BlueprintId nvarchar(128) no
BlueprintVersion nvarchar(32) no
ContextsJson nvarchar(max) no
RelationshipsJson nvarchar(max) no
PublishedEventsJson nvarchar(max) no
DerivedAt datetimeoffset no

dbo.DomainModels

Owner: DomainModel

CREATE TABLE [dbo].[DomainModels] (
    [DomainModelId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [BlueprintId] nvarchar(128) NOT NULL,
    [BlueprintVersion] nvarchar(32) NOT NULL,
    [ContextId] nvarchar(64) NOT NULL,
    [AggregatesJson] nvarchar(max) NOT NULL,
    [EventsJson] nvarchar(max) NOT NULL,
    [DerivedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_DomainModels] PRIMARY KEY ([DomainModelId])
);
CREATE UNIQUE INDEX [UX_DomainModels_Blueprint_Context] ON [dbo].[DomainModels] ([BlueprintId], [BlueprintVersion], [ContextId]);
Column Type Null Key Description
DomainModelId uniqueidentifier no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
BlueprintId nvarchar(128) no
BlueprintVersion nvarchar(32) no
ContextId nvarchar(64) no
AggregatesJson nvarchar(max) no
EventsJson nvarchar(max) no
DerivedAt datetimeoffset no