Skip to content

GenerationRecipeService — 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.GenerationRecipes

Owner: GenerationRecipe

CREATE TABLE [dbo].[GenerationRecipes] (
    [RecipeId] uniqueidentifier NOT NULL,
    [Version] int NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [BlueprintId] nvarchar(128) NOT NULL,
    [BlueprintVersion] nvarchar(32) NOT NULL,
    [LibrariesJson] nvarchar(max) NOT NULL,
    [RepositoryLayoutJson] nvarchar(2000) NOT NULL,
    [CompatibilityEvidenceJson] nvarchar(max) NOT NULL,
    [State] int NOT NULL,
    [ApprovedBy] nvarchar(256) NULL,
    [CreatedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_GenerationRecipes] PRIMARY KEY ([RecipeId], [Version])
);
CREATE INDEX [IX_Recipes_Project_State] ON [dbo].[GenerationRecipes] ([TenantId], [ProjectId], [State]);
Column Type Null Key Description
RecipeId uniqueidentifier no PK
Version int no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
BlueprintId nvarchar(128) no
BlueprintVersion nvarchar(32) no
LibrariesJson nvarchar(max) no
RepositoryLayoutJson nvarchar(2000) no
CompatibilityEvidenceJson nvarchar(max) no
State int no
ApprovedBy nvarchar(256) yes
CreatedAt datetimeoffset no

dbo.ModulePlanEntries

Owner: ModulePlanEntry

CREATE TABLE [dbo].[ModulePlanEntries] (
    [RecipeId] uniqueidentifier NOT NULL,
    [Version] int NOT NULL,
    [Name] nvarchar(96) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Kind] int NOT NULL,
    [ContextId] nvarchar(64) NULL,
    [TemplateId] nvarchar(96) NOT NULL,
    [TemplateVersion] nvarchar(32) NOT NULL,
    [SwitchesJson] nvarchar(2000) NOT NULL,
    [ParametersJson] nvarchar(max) NOT NULL,
    [Path] nvarchar(256) NOT NULL,
    CONSTRAINT [PK_ModulePlanEntries] PRIMARY KEY ([RecipeId], [Version], [Name])
);
ALTER TABLE [dbo].[ModulePlanEntries] ADD CONSTRAINT [FK_ModulePlanEntries_GenerationRecipes_RecipeId] FOREIGN KEY ([RecipeId]) REFERENCES [dbo].[GenerationRecipes] ([RecipeId]);
Column Type Null Key Description
RecipeId uniqueidentifier no PK FK → GenerationRecipes.RecipeId
Version int no PK
Name nvarchar(96) no PK
TenantId nvarchar(64) no
Kind int no
ContextId nvarchar(64) yes
TemplateId nvarchar(96) no
TemplateVersion nvarchar(32) no
SwitchesJson nvarchar(2000) no
ParametersJson nvarchar(max) no
Path nvarchar(256) no

dbo.GeneratedOutputs

Owner: GeneratedOutput · Retention: lifetime of the product plus 7 years

CREATE TABLE [dbo].[GeneratedOutputs] (
    [OutputId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NOT NULL,
    [RecipeId] uniqueidentifier NOT NULL,
    [RecipeVersion] int NOT NULL,
    [ModuleName] nvarchar(96) NOT NULL,
    [RunId] uniqueidentifier NOT NULL,
    [AttemptId] uniqueidentifier NOT NULL,
    [AgentReleaseId] nvarchar(256) NOT NULL,
    [TemplateId] nvarchar(96) NOT NULL,
    [TemplateVersion] nvarchar(32) NOT NULL,
    [ManifestHash] nvarchar(128) NOT NULL,
    [GeneratedFilesJson] nvarchar(max) NOT NULL,
    [PreservedFilesJson] nvarchar(max) NOT NULL,
    [ProposalId] uniqueidentifier NULL,
    [Commit] nvarchar(64) NULL,
    [GeneratedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_GeneratedOutputs] PRIMARY KEY ([OutputId])
);
CREATE INDEX [IX_Outputs_Project_Module] ON [dbo].[GeneratedOutputs] ([TenantId], [ProjectId], [ModuleName], [GeneratedAt]);
CREATE INDEX [IX_Outputs_Run] ON [dbo].[GeneratedOutputs] ([RunId]);
Column Type Null Key Description
OutputId uniqueidentifier no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) no
RecipeId uniqueidentifier no
RecipeVersion int no
ModuleName nvarchar(96) no
RunId uniqueidentifier no
AttemptId uniqueidentifier no
AgentReleaseId nvarchar(256) no
TemplateId nvarchar(96) no
TemplateVersion nvarchar(32) no
ManifestHash nvarchar(128) no
GeneratedFilesJson nvarchar(max) no
PreservedFilesJson nvarchar(max) no
ProposalId uniqueidentifier yes
Commit nvarchar(64) yes
GeneratedAt datetimeoffset no