Skip to content

IntegrationService — 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.Connections

Owner: Connection

CREATE TABLE [dbo].[Connections] (
    [ConnectionId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Name] nvarchar(256) NOT NULL,
    [Provider] nvarchar(64) NOT NULL,
    [EndpointPolicyJson] nvarchar(max) NOT NULL,
    [CredentialKind] int NOT NULL,
    [CredentialRef] nvarchar(512) NOT NULL,
    [RotationJson] nvarchar(1024) NOT NULL,
    [State] int NOT NULL,
    [Healthy] bit NOT NULL DEFAULT (0),
    [LastVerifiedAt] datetimeoffset NULL,
    [Version] rowversion NOT NULL,
    CONSTRAINT [PK_Connections] PRIMARY KEY ([ConnectionId])
);
CREATE UNIQUE INDEX [UX_Connections_Tenant_Name] ON [dbo].[Connections] ([TenantId], [Name]);
CREATE INDEX [IX_Connections_Provider_State] ON [dbo].[Connections] ([TenantId], [Provider], [State]);
Column Type Null Key Description
ConnectionId uniqueidentifier no PK
TenantId nvarchar(64) no
Name nvarchar(256) no
Provider nvarchar(64) no
EndpointPolicyJson nvarchar(max) no
CredentialKind int no
CredentialRef nvarchar(512) no
RotationJson nvarchar(1024) no
State int no
Healthy bit no
LastVerifiedAt datetimeoffset yes
Version rowversion no

dbo.ConnectionGrants

Owner: Grant

CREATE TABLE [dbo].[ConnectionGrants] (
    [GrantId] uniqueidentifier NOT NULL,
    [ConnectionId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SubjectKind] int NOT NULL,
    [SubjectId] nvarchar(256) NOT NULL,
    [ScopesJson] nvarchar(2000) NOT NULL,
    [GrantedBy] nvarchar(256) NOT NULL,
    [GrantedAt] datetimeoffset NOT NULL,
    [ExpiresAt] datetimeoffset NULL,
    CONSTRAINT [PK_ConnectionGrants] PRIMARY KEY ([GrantId])
);
ALTER TABLE [dbo].[ConnectionGrants] ADD CONSTRAINT [FK_ConnectionGrants_Connections_ConnectionId] FOREIGN KEY ([ConnectionId]) REFERENCES [dbo].[Connections] ([ConnectionId]);
CREATE UNIQUE INDEX [UX_Grants_Connection_Subject] ON [dbo].[ConnectionGrants] ([ConnectionId], [SubjectKind], [SubjectId]);
Column Type Null Key Description
GrantId uniqueidentifier no PK
ConnectionId uniqueidentifier no FK → Connections.ConnectionId
TenantId nvarchar(64) no
SubjectKind int no
SubjectId nvarchar(256) no
ScopesJson nvarchar(2000) no
GrantedBy nvarchar(256) no
GrantedAt datetimeoffset no
ExpiresAt datetimeoffset yes