Skip to content

RepositoryIntelligenceService — 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.RepositoryIndexSets

Owner: RepositoryIndexSet

CREATE TABLE [dbo].[RepositoryIndexSets] (
    [IndexSetId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [SourceId] uniqueidentifier NOT NULL,
    [SnapshotId] uniqueidentifier NOT NULL,
    [Revision] nvarchar(64) NOT NULL,
    [State] int NOT NULL,
    [KindsJson] nvarchar(512) NOT NULL,
    [FileCount] int NOT NULL DEFAULT (0),
    [SymbolCount] int NOT NULL DEFAULT (0),
    [LanguagesJson] nvarchar(256) NOT NULL,
    [BuiltAt] datetimeoffset NULL,
    CONSTRAINT [PK_RepositoryIndexSets] PRIMARY KEY ([IndexSetId])
);
CREATE UNIQUE INDEX [UX_RepoIndex_Source_Revision] ON [dbo].[RepositoryIndexSets] ([SourceId], [Revision]);
Column Type Null Key Description
IndexSetId uniqueidentifier no PK
TenantId nvarchar(64) no
SourceId uniqueidentifier no
SnapshotId uniqueidentifier no
Revision nvarchar(64) no
State int no
KindsJson nvarchar(512) no
FileCount int no
SymbolCount int no
LanguagesJson nvarchar(256) no
BuiltAt datetimeoffset yes

dbo.Symbols

Owner: SymbolEntry

CREATE TABLE [dbo].[Symbols] (
    [SymbolId] uniqueidentifier NOT NULL,
    [IndexSetId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Name] nvarchar(512) NOT NULL,
    [Kind] nvarchar(16) NOT NULL,
    [Path] nvarchar(1024) NOT NULL,
    [StartLine] int NOT NULL,
    [EndLine] int NOT NULL,
    [ContainerSymbolId] uniqueidentifier NULL,
    [SignatureHash] nvarchar(128) NOT NULL,
    CONSTRAINT [PK_Symbols] PRIMARY KEY ([SymbolId])
);
ALTER TABLE [dbo].[Symbols] ADD CONSTRAINT [FK_Symbols_RepositoryIndexSets_IndexSetId] FOREIGN KEY ([IndexSetId]) REFERENCES [dbo].[RepositoryIndexSets] ([IndexSetId]);
CREATE INDEX [IX_Symbols_IndexSet_Name] ON [dbo].[Symbols] ([IndexSetId], [Name]);
CREATE INDEX [IX_Symbols_IndexSet_Path] ON [dbo].[Symbols] ([IndexSetId], [Path]);
Column Type Null Key Description
SymbolId uniqueidentifier no PK
IndexSetId uniqueidentifier no FK → RepositoryIndexSets.IndexSetId
TenantId nvarchar(64) no
Name nvarchar(512) no
Kind nvarchar(16) no
Path nvarchar(1024) no
StartLine int no
EndLine int no
ContainerSymbolId uniqueidentifier yes
SignatureHash nvarchar(128) no

dbo.DependencyEdges

Owner: DependencyEdge

CREATE TABLE [dbo].[DependencyEdges] (
    [EdgeId] uniqueidentifier NOT NULL,
    [IndexSetId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Kind] nvarchar(16) NOT NULL,
    [FromRef] nvarchar(512) NOT NULL,
    [ToRef] nvarchar(512) NOT NULL,
    [Version] nvarchar(64) NULL,
    CONSTRAINT [PK_DependencyEdges] PRIMARY KEY ([EdgeId])
);
ALTER TABLE [dbo].[DependencyEdges] ADD CONSTRAINT [FK_DependencyEdges_RepositoryIndexSets_IndexSetId] FOREIGN KEY ([IndexSetId]) REFERENCES [dbo].[RepositoryIndexSets] ([IndexSetId]);
CREATE INDEX [IX_DependencyEdges_From] ON [dbo].[DependencyEdges] ([IndexSetId], [Kind], [FromRef]);
CREATE INDEX [IX_DependencyEdges_To] ON [dbo].[DependencyEdges] ([IndexSetId], [Kind], [ToRef]);
Column Type Null Key Description
EdgeId uniqueidentifier no PK
IndexSetId uniqueidentifier no FK → RepositoryIndexSets.IndexSetId
TenantId nvarchar(64) no
Kind nvarchar(16) no
FromRef nvarchar(512) no
ToRef nvarchar(512) no
Version nvarchar(64) yes

dbo.Ownership

Owner: OwnershipEntry

CREATE TABLE [dbo].[Ownership] (
    [IndexSetId] uniqueidentifier NOT NULL,
    [Path] nvarchar(1024) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [OwnersJson] nvarchar(1024) NOT NULL,
    [LastCommit] nvarchar(64) NOT NULL,
    [LastChangedAt] datetimeoffset NOT NULL,
    [Churn90d] int NOT NULL DEFAULT (0),
    CONSTRAINT [PK_Ownership] PRIMARY KEY ([IndexSetId], [Path])
);
ALTER TABLE [dbo].[Ownership] ADD CONSTRAINT [FK_Ownership_RepositoryIndexSets_IndexSetId] FOREIGN KEY ([IndexSetId]) REFERENCES [dbo].[RepositoryIndexSets] ([IndexSetId]);
Column Type Null Key Description
IndexSetId uniqueidentifier no PK FK → RepositoryIndexSets.IndexSetId
Path nvarchar(1024) no PK
TenantId nvarchar(64) no
OwnersJson nvarchar(1024) no
LastCommit nvarchar(64) no
LastChangedAt datetimeoffset no
Churn90d int no