WorkflowEngineService — 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.WorkflowDefinitions¶
Owner: WorkflowDefinitionVersion
CREATE TABLE [dbo].[WorkflowDefinitions] (
[ReleaseId] nvarchar(256) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[DefinitionId] nvarchar(128) NOT NULL,
[Version] nvarchar(64) NOT NULL,
[GraphHash] nvarchar(128) NOT NULL,
[StepCount] int NOT NULL,
[InputSchemaRef] nvarchar(512) NOT NULL,
[OutputSchemaRef] nvarchar(512) NOT NULL,
[MaxLoopIterations] int NOT NULL,
[LoadedAt] datetimeoffset NOT NULL,
CONSTRAINT [PK_WorkflowDefinitions] PRIMARY KEY ([ReleaseId])
);
CREATE INDEX [IX_WorkflowDefinitions_Definition] ON [dbo].[WorkflowDefinitions] ([TenantId], [DefinitionId], [Version]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
ReleaseId |
nvarchar(256) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
DefinitionId |
nvarchar(128) |
no | ||
Version |
nvarchar(64) |
no | ||
GraphHash |
nvarchar(128) |
no | ||
StepCount |
int |
no | ||
InputSchemaRef |
nvarchar(512) |
no | ||
OutputSchemaRef |
nvarchar(512) |
no | ||
MaxLoopIterations |
int |
no | ||
LoadedAt |
datetimeoffset |
no |
dbo.StepDefinitions¶
Owner: StepDefinition
CREATE TABLE [dbo].[StepDefinitions] (
[ReleaseId] nvarchar(256) NOT NULL,
[StepId] nvarchar(128) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Kind] int NOT NULL,
[Name] nvarchar(256) NOT NULL,
[AgentId] nvarchar(128) NULL,
[ToolId] nvarchar(128) NULL,
[ActionClass] nvarchar(16) NULL,
[FailurePolicy] int NOT NULL,
[MaxAttempts] int NOT NULL,
[TimeoutMinutes] int NOT NULL,
[CompensationStepId] nvarchar(128) NULL,
[InputMappingRef] nvarchar(512) NULL,
[ConditionExpression] nvarchar(2000) NULL,
CONSTRAINT [PK_StepDefinitions] PRIMARY KEY ([ReleaseId], [StepId])
);
ALTER TABLE [dbo].[StepDefinitions] ADD CONSTRAINT [FK_StepDefinitions_WorkflowDefinitions_ReleaseId] FOREIGN KEY ([ReleaseId]) REFERENCES [dbo].[WorkflowDefinitions] ([ReleaseId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
ReleaseId |
nvarchar(256) |
no | PK FK → WorkflowDefinitions.ReleaseId | |
StepId |
nvarchar(128) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
Kind |
int |
no | ||
Name |
nvarchar(256) |
no | ||
AgentId |
nvarchar(128) |
yes | ||
ToolId |
nvarchar(128) |
yes | ||
ActionClass |
nvarchar(16) |
yes | ||
FailurePolicy |
int |
no | ||
MaxAttempts |
int |
no | ||
TimeoutMinutes |
int |
no | ||
CompensationStepId |
nvarchar(128) |
yes | ||
InputMappingRef |
nvarchar(512) |
yes | ||
ConditionExpression |
nvarchar(2000) |
yes |
dbo.EdgeDefinitions¶
Owner: EdgeDefinition
CREATE TABLE [dbo].[EdgeDefinitions] (
[ReleaseId] nvarchar(256) NOT NULL,
[FromStepId] nvarchar(128) NOT NULL,
[ToStepId] nvarchar(128) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Guard] nvarchar(2000) NULL,
[IsLoopBack] bit NOT NULL DEFAULT (0),
CONSTRAINT [PK_EdgeDefinitions] PRIMARY KEY ([ReleaseId], [FromStepId], [ToStepId])
);
ALTER TABLE [dbo].[EdgeDefinitions] ADD CONSTRAINT [FK_EdgeDefinitions_WorkflowDefinitions_ReleaseId] FOREIGN KEY ([ReleaseId]) REFERENCES [dbo].[WorkflowDefinitions] ([ReleaseId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
ReleaseId |
nvarchar(256) |
no | PK FK → WorkflowDefinitions.ReleaseId | |
FromStepId |
nvarchar(128) |
no | PK | |
ToStepId |
nvarchar(128) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
Guard |
nvarchar(2000) |
yes | ||
IsLoopBack |
bit |
no |
dbo.WorkflowRuns¶
Owner: WorkflowRun
CREATE TABLE [dbo].[WorkflowRuns] (
[RunId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ProjectId] nvarchar(64) NOT NULL,
[DefinitionReleaseId] nvarchar(256) NOT NULL,
[GraphHash] nvarchar(128) NOT NULL,
[State] int NOT NULL,
[VariablesRef] nvarchar(512) NULL,
[ActiveStepRuns] int NOT NULL DEFAULT (0),
[LastOutcomeSequence] bigint NOT NULL DEFAULT (0),
[Version] rowversion NOT NULL,
CONSTRAINT [PK_WorkflowRuns] PRIMARY KEY ([RunId])
);
ALTER TABLE [dbo].[WorkflowRuns] ADD CONSTRAINT [FK_WorkflowRuns_WorkflowDefinitions_DefinitionReleaseId] FOREIGN KEY ([DefinitionReleaseId]) REFERENCES [dbo].[WorkflowDefinitions] ([ReleaseId]);
CREATE INDEX [IX_WorkflowRuns_Tenant_State] ON [dbo].[WorkflowRuns] ([TenantId], [State]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
RunId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
ProjectId |
nvarchar(64) |
no | ||
DefinitionReleaseId |
nvarchar(256) |
no | FK → WorkflowDefinitions.ReleaseId | |
GraphHash |
nvarchar(128) |
no | ||
State |
int |
no | ||
VariablesRef |
nvarchar(512) |
yes | ||
ActiveStepRuns |
int |
no | ||
LastOutcomeSequence |
bigint |
no | ||
Version |
rowversion |
no |
dbo.StepRuns¶
Owner: StepRun
CREATE TABLE [dbo].[StepRuns] (
[StepRunId] uniqueidentifier NOT NULL,
[RunId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[StepId] nvarchar(128) NOT NULL,
[Kind] int NOT NULL,
[State] int NOT NULL,
[Iteration] int NOT NULL DEFAULT (1),
[AttemptIdsJson] nvarchar(2000) NOT NULL DEFAULT ('[]'),
[OutputRef] nvarchar(512) NULL,
[ApprovalId] uniqueidentifier NULL,
[StartedAt] datetimeoffset NULL,
[EndedAt] datetimeoffset NULL,
CONSTRAINT [PK_StepRuns] PRIMARY KEY ([StepRunId])
);
ALTER TABLE [dbo].[StepRuns] ADD CONSTRAINT [FK_StepRuns_WorkflowRuns_RunId] FOREIGN KEY ([RunId]) REFERENCES [dbo].[WorkflowRuns] ([RunId]);
CREATE UNIQUE INDEX [UX_StepRuns_Run_Step_Iteration] ON [dbo].[StepRuns] ([RunId], [StepId], [Iteration]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
StepRunId |
uniqueidentifier |
no | PK | |
RunId |
uniqueidentifier |
no | FK → WorkflowRuns.RunId | |
TenantId |
nvarchar(64) |
no | ||
StepId |
nvarchar(128) |
no | ||
Kind |
int |
no | ||
State |
int |
no | ||
Iteration |
int |
no | ||
AttemptIdsJson |
nvarchar(2000) |
no | ||
OutputRef |
nvarchar(512) |
yes | ||
ApprovalId |
uniqueidentifier |
yes | ||
StartedAt |
datetimeoffset |
yes | ||
EndedAt |
datetimeoffset |
yes |
dbo.Timers¶
Owner: TimerEntry
CREATE TABLE [dbo].[Timers] (
[TimerId] uniqueidentifier NOT NULL,
[RunId] uniqueidentifier NOT NULL,
[StepRunId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[DueAt] datetimeoffset NOT NULL,
[Fired] bit NOT NULL DEFAULT (0),
CONSTRAINT [PK_Timers] PRIMARY KEY ([TimerId])
);
ALTER TABLE [dbo].[Timers] ADD CONSTRAINT [FK_Timers_WorkflowRuns_RunId] FOREIGN KEY ([RunId]) REFERENCES [dbo].[WorkflowRuns] ([RunId]);
ALTER TABLE [dbo].[Timers] ADD CONSTRAINT [FK_Timers_StepRuns_StepRunId] FOREIGN KEY ([StepRunId]) REFERENCES [dbo].[StepRuns] ([StepRunId]);
CREATE INDEX [IX_Timers_Due] ON [dbo].[Timers] ([Fired], [DueAt]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
TimerId |
uniqueidentifier |
no | PK | |
RunId |
uniqueidentifier |
no | FK → WorkflowRuns.RunId | |
StepRunId |
uniqueidentifier |
no | FK → StepRuns.StepRunId | |
TenantId |
nvarchar(64) |
no | ||
DueAt |
datetimeoffset |
no | ||
Fired |
bit |
no |
dbo.CompensationEntries¶
Owner: CompensationEntry
CREATE TABLE [dbo].[CompensationEntries] (
[EntryId] uniqueidentifier NOT NULL,
[RunId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ForStepRunId] uniqueidentifier NOT NULL,
[CompensationStepId] nvarchar(128) NOT NULL,
[ExecutionOrder] int NOT NULL,
[State] int NOT NULL,
CONSTRAINT [PK_CompensationEntries] PRIMARY KEY ([EntryId])
);
ALTER TABLE [dbo].[CompensationEntries] ADD CONSTRAINT [FK_CompensationEntries_WorkflowRuns_RunId] FOREIGN KEY ([RunId]) REFERENCES [dbo].[WorkflowRuns] ([RunId]);
ALTER TABLE [dbo].[CompensationEntries] ADD CONSTRAINT [FK_CompensationEntries_StepRuns_ForStepRunId] FOREIGN KEY ([ForStepRunId]) REFERENCES [dbo].[StepRuns] ([StepRunId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
EntryId |
uniqueidentifier |
no | PK | |
RunId |
uniqueidentifier |
no | FK → WorkflowRuns.RunId | |
TenantId |
nvarchar(64) |
no | ||
ForStepRunId |
uniqueidentifier |
no | FK → StepRuns.StepRunId | |
CompensationStepId |
nvarchar(128) |
no | ||
ExecutionOrder |
int |
no | ||
State |
int |
no |