Skip to content

TemplateRegistryService — 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.TemplateVersions

Owner: TemplateVersion

CREATE TABLE [dbo].[TemplateVersions] (
    [TemplateId] nvarchar(96) NOT NULL,
    [Version] nvarchar(32) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Layer] int NOT NULL,
    [Repository] nvarchar(256) NOT NULL,
    [Commit] nvarchar(64) NOT NULL,
    [ManifestJson] nvarchar(max) NOT NULL,
    [ManifestHash] nvarchar(128) NOT NULL,
    [State] int NOT NULL,
    [ReleaseId] nvarchar(256) NULL,
    [DiscoveredAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_TemplateVersions] PRIMARY KEY ([TemplateId], [Version])
);
CREATE INDEX [IX_Templates_State] ON [dbo].[TemplateVersions] ([State], [Layer]);
Column Type Null Key Description
TemplateId nvarchar(96) no PK
Version nvarchar(32) no PK
TenantId nvarchar(64) no
Layer int no
Repository nvarchar(256) no
Commit nvarchar(64) no
ManifestJson nvarchar(max) no
ManifestHash nvarchar(128) no
State int no
ReleaseId nvarchar(256) yes
DiscoveredAt datetimeoffset no

dbo.LibraryVersions

Owner: LibraryVersion

CREATE TABLE [dbo].[LibraryVersions] (
    [LibraryId] nvarchar(96) NOT NULL,
    [Version] nvarchar(32) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Layer] int NOT NULL,
    [Area] nvarchar(64) NOT NULL,
    [PackagesJson] nvarchar(max) NOT NULL,
    [OptionsSectionsJson] nvarchar(max) NULL,
    [ConsumersJson] nvarchar(max) NOT NULL,
    [State] int NOT NULL,
    [DiscoveredAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_LibraryVersions] PRIMARY KEY ([LibraryId], [Version])
);
CREATE INDEX [IX_Libraries_Area] ON [dbo].[LibraryVersions] ([Area], [State]);
Column Type Null Key Description
LibraryId nvarchar(96) no PK
Version nvarchar(32) no PK
TenantId nvarchar(64) no
Layer int no
Area nvarchar(64) no
PackagesJson nvarchar(max) no
OptionsSectionsJson nvarchar(max) yes
ConsumersJson nvarchar(max) no
State int no
DiscoveredAt datetimeoffset no

dbo.CompatibilityEntries

Owner: CompatibilityEntry

CREATE TABLE [dbo].[CompatibilityEntries] (
    [EntryId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SubjectKind] nvarchar(16) NOT NULL,
    [SubjectId] nvarchar(96) NOT NULL,
    [SubjectVersion] nvarchar(32) NOT NULL,
    [WithKind] nvarchar(16) NOT NULL,
    [WithId] nvarchar(96) NOT NULL,
    [WithVersion] nvarchar(32) NULL,
    [Result] int NOT NULL,
    [EvidenceRef] nvarchar(512) NULL,
    [CheckedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_CompatibilityEntries] PRIMARY KEY ([EntryId])
);
CREATE UNIQUE INDEX [UX_Compat_Cell] ON [dbo].[CompatibilityEntries] ([SubjectKind], [SubjectId], [SubjectVersion], [WithKind], [WithId], [WithVersion]);
Column Type Null Key Description
EntryId uniqueidentifier no PK
TenantId nvarchar(64) no
SubjectKind nvarchar(16) no
SubjectId nvarchar(96) no
SubjectVersion nvarchar(32) no
WithKind nvarchar(16) no
WithId nvarchar(96) no
WithVersion nvarchar(32) yes
Result int no
EvidenceRef nvarchar(512) yes
CheckedAt datetimeoffset no