Skip to content

EnvelopeRegistryService — 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.Topics

Owner: TopicDefinition

CREATE TABLE [dbo].[Topics] (
    [Topic] nvarchar(200) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Context] nvarchar(64) NOT NULL,
    [Area] nvarchar(64) NOT NULL,
    [Version] int NOT NULL,
    [EventName] nvarchar(96) NOT NULL,
    [Producer] nvarchar(96) NOT NULL,
    [CurrentSchemaVersion] nvarchar(16) NOT NULL,
    [State] int NOT NULL,
    [RegisteredAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_Topics] PRIMARY KEY ([Topic])
);
CREATE INDEX [IX_Topics_Producer] ON [dbo].[Topics] ([Producer]);
CREATE UNIQUE INDEX [UX_Topics_EventName] ON [dbo].[Topics] ([EventName]);
Column Type Null Key Description
Topic nvarchar(200) no PK
TenantId nvarchar(64) no Platform tenant; topics are platform-wide.
Context nvarchar(64) no
Area nvarchar(64) no
Version int no
EventName nvarchar(96) no
Producer nvarchar(96) no
CurrentSchemaVersion nvarchar(16) no
State int no
RegisteredAt datetimeoffset no

dbo.SchemaVersions

Owner: SchemaVersion

CREATE TABLE [dbo].[SchemaVersions] (
    [Topic] nvarchar(200) NOT NULL,
    [Version] nvarchar(16) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SchemaRef] nvarchar(512) NOT NULL,
    [Compatibility] int NOT NULL,
    [PublishedAt] datetimeoffset NOT NULL,
    [DeprecatedAt] datetimeoffset NULL,
    CONSTRAINT [PK_SchemaVersions] PRIMARY KEY ([Topic], [Version])
);
ALTER TABLE [dbo].[SchemaVersions] ADD CONSTRAINT [FK_SchemaVersions_Topics_Topic] FOREIGN KEY ([Topic]) REFERENCES [dbo].[Topics] ([Topic]);
Column Type Null Key Description
Topic nvarchar(200) no PK FK → Topics.Topic
Version nvarchar(16) no PK
TenantId nvarchar(64) no
SchemaRef nvarchar(512) no
Compatibility int no
PublishedAt datetimeoffset no
DeprecatedAt datetimeoffset yes

dbo.TopicConsumers

Owner: TopicDefinition

CREATE TABLE [dbo].[TopicConsumers] (
    [Topic] nvarchar(200) NOT NULL,
    [Consumer] nvarchar(96) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [AcknowledgedSchemaVersion] nvarchar(16) NOT NULL,
    CONSTRAINT [PK_TopicConsumers] PRIMARY KEY ([Topic], [Consumer])
);
ALTER TABLE [dbo].[TopicConsumers] ADD CONSTRAINT [FK_TopicConsumers_Topics_Topic] FOREIGN KEY ([Topic]) REFERENCES [dbo].[Topics] ([Topic]);
Column Type Null Key Description
Topic nvarchar(200) no PK FK → Topics.Topic
Consumer nvarchar(96) no PK
TenantId nvarchar(64) no
AcknowledgedSchemaVersion nvarchar(16) no

dbo.EnvelopeProfiles

Owner: EnvelopeProfile

CREATE TABLE [dbo].[EnvelopeProfiles] (
    [Profile] int NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [EnvelopeSchemaVersion] nvarchar(16) NOT NULL,
    [TransportPropertiesJson] nvarchar(2000) NOT NULL,
    [OutboxContractJson] nvarchar(4000) NOT NULL,
    [InboxContractJson] nvarchar(4000) NOT NULL,
    [DedupWindowHours] int NOT NULL DEFAULT (72),
    [Active] bit NOT NULL DEFAULT (1),
    CONSTRAINT [PK_EnvelopeProfiles] PRIMARY KEY ([Profile])
);
Column Type Null Key Description
Profile int no PK
TenantId nvarchar(64) no
EnvelopeSchemaVersion nvarchar(16) no
TransportPropertiesJson nvarchar(2000) no
OutboxContractJson nvarchar(4000) no
InboxContractJson nvarchar(4000) no
DedupWindowHours int no
Active bit no