Skip to content

ApprovalPolicyService — 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.ApprovalRules

Owner: ApprovalRule

CREATE TABLE [dbo].[ApprovalRules] (
    [RuleId] nvarchar(128) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Scope] nvarchar(96) NOT NULL,
    [ActionClass] nvarchar(16) NOT NULL,
    [ActionPattern] nvarchar(256) NULL,
    [ApproverRolesJson] nvarchar(256) NOT NULL,
    [ExcludeRequester] bit NOT NULL DEFAULT (1),
    [ExcludeAuthor] bit NOT NULL DEFAULT (1),
    [Quorum] int NOT NULL DEFAULT (1),
    [ExpiryMinutes] int NOT NULL,
    [BreakGlassAllowed] bit NOT NULL DEFAULT (0),
    [PolicyRevision] nvarchar(64) NOT NULL,
    [Active] bit NOT NULL DEFAULT (1),
    CONSTRAINT [PK_ApprovalRules] PRIMARY KEY ([RuleId])
);
CREATE INDEX [IX_ApprovalRules_Scope_Class] ON [dbo].[ApprovalRules] ([TenantId], [Scope], [ActionClass], [Active]);
Column Type Null Key Description
RuleId nvarchar(128) no PK
TenantId nvarchar(64) no
Scope nvarchar(96) no
ActionClass nvarchar(16) no
ActionPattern nvarchar(256) yes
ApproverRolesJson nvarchar(256) no
ExcludeRequester bit no
ExcludeAuthor bit no
Quorum int no
ExpiryMinutes int no
BreakGlassAllowed bit no
PolicyRevision nvarchar(64) no
Active bit no

dbo.RoutingEvaluations

Owner: RoutingEvaluation · Retention: 7 years as audit evidence

CREATE TABLE [dbo].[RoutingEvaluations] (
    [EvaluationId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ApprovalId] uniqueidentifier NOT NULL,
    [RunId] uniqueidentifier NULL,
    [RuleId] nvarchar(128) NOT NULL,
    [ActionClass] nvarchar(16) NOT NULL,
    [RequesterId] nvarchar(256) NOT NULL,
    [AuthorId] nvarchar(256) NULL,
    [EligibleApproversJson] nvarchar(max) NULL,
    [DeciderId] nvarchar(256) NULL,
    [Outcome] int NOT NULL,
    [BreakGlass] bit NOT NULL DEFAULT (0),
    [ExpiresAt] datetimeoffset NOT NULL,
    [EvaluatedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_RoutingEvaluations] PRIMARY KEY ([EvaluationId])
);
CREATE INDEX [IX_Routing_Approval] ON [dbo].[RoutingEvaluations] ([ApprovalId]);
Column Type Null Key Description
EvaluationId uniqueidentifier no PK
TenantId nvarchar(64) no
ApprovalId uniqueidentifier no
RunId uniqueidentifier yes
RuleId nvarchar(128) no
ActionClass nvarchar(16) no
RequesterId nvarchar(256) no
AuthorId nvarchar(256) yes
EligibleApproversJson nvarchar(max) yes
DeciderId nvarchar(256) yes
Outcome int no
BreakGlass bit no
ExpiresAt datetimeoffset no
EvaluatedAt datetimeoffset no