VectorMemoryService — 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.IndexRevisions¶
Owner: IndexRevision
CREATE TABLE [dbo].[IndexRevisions] (
[IndexRevisionId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[CollectionId] uniqueidentifier NOT NULL,
[Kind] int NOT NULL,
[Revision] int NOT NULL,
[EmbeddingProfileVersion] nvarchar(32) NULL,
[VectorProfile] nvarchar(32) NULL,
[State] int NOT NULL,
[ItemCount] bigint NOT NULL DEFAULT (0),
[BuiltFromSnapshotsJson] nvarchar(max) NOT NULL,
[BuiltAt] datetimeoffset NULL,
CONSTRAINT [PK_IndexRevisions] PRIMARY KEY ([IndexRevisionId])
);
CREATE UNIQUE INDEX [UX_IndexRevisions_Collection_Kind_Revision] ON [dbo].[IndexRevisions] ([CollectionId], [Kind], [Revision]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
IndexRevisionId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
CollectionId |
uniqueidentifier |
no | ||
Kind |
int |
no | ||
Revision |
int |
no | ||
EmbeddingProfileVersion |
nvarchar(32) |
yes | ||
VectorProfile |
nvarchar(32) |
yes | ||
State |
int |
no | ||
ItemCount |
bigint |
no | ||
BuiltFromSnapshotsJson |
nvarchar(max) |
no | ||
BuiltAt |
datetimeoffset |
yes |
dbo.IndexItems¶
Owner: IndexRevision
CREATE TABLE [dbo].[IndexItems] (
[IndexRevisionId] uniqueidentifier NOT NULL,
[ChunkId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[SourceId] uniqueidentifier NOT NULL,
[SourceVersion] nvarchar(128) NOT NULL,
[AclScopeJson] nvarchar(2000) NOT NULL,
[VectorRef] nvarchar(256) NULL,
CONSTRAINT [PK_IndexItems] PRIMARY KEY ([IndexRevisionId], [ChunkId])
);
ALTER TABLE [dbo].[IndexItems] ADD CONSTRAINT [FK_IndexItems_IndexRevisions_IndexRevisionId] FOREIGN KEY ([IndexRevisionId]) REFERENCES [dbo].[IndexRevisions] ([IndexRevisionId]);
CREATE INDEX [IX_IndexItems_Source] ON [dbo].[IndexItems] ([SourceId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
IndexRevisionId |
uniqueidentifier |
no | PK FK → IndexRevisions.IndexRevisionId | |
ChunkId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
SourceId |
uniqueidentifier |
no | ||
SourceVersion |
nvarchar(128) |
no | ||
AclScopeJson |
nvarchar(2000) |
no | ||
VectorRef |
nvarchar(256) |
yes | Point id in the vector backend. |
dbo.GraphFacts¶
Owner: GraphFact
CREATE TABLE [dbo].[GraphFacts] (
[FactId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Domain] int NOT NULL,
[Subject] nvarchar(256) NOT NULL,
[Predicate] nvarchar(64) NOT NULL,
[Object] nvarchar(256) NOT NULL,
[ValidFrom] datetimeoffset NULL,
[ValidTo] datetimeoffset NULL,
[ObservedAt] datetimeoffset NOT NULL,
[SourceId] uniqueidentifier NULL,
[SourceVersion] nvarchar(128) NULL,
[Confidence] decimal(5,4) NOT NULL,
[TrustTier] nvarchar(24) NOT NULL,
[Verified] bit NOT NULL DEFAULT (0),
CONSTRAINT [PK_GraphFacts] PRIMARY KEY ([FactId])
);
CREATE INDEX [IX_GraphFacts_Subject] ON [dbo].[GraphFacts] ([TenantId], [Domain], [Subject], [Predicate]);
CREATE INDEX [IX_GraphFacts_Object] ON [dbo].[GraphFacts] ([TenantId], [Domain], [Object]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
FactId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
Domain |
int |
no | ||
Subject |
nvarchar(256) |
no | ||
Predicate |
nvarchar(64) |
no | ||
Object |
nvarchar(256) |
no | ||
ValidFrom |
datetimeoffset |
yes | ||
ValidTo |
datetimeoffset |
yes | ||
ObservedAt |
datetimeoffset |
no | ||
SourceId |
uniqueidentifier |
yes | ||
SourceVersion |
nvarchar(128) |
yes | ||
Confidence |
decimal(5,4) |
no | ||
TrustTier |
nvarchar(24) |
no | ||
Verified |
bit |
no |
dbo.RetrievalQueries¶
Owner: RetrievalQuery · Retention: 90 days (traces class); queries referenced by context snapshots follow the run's retention
CREATE TABLE [dbo].[RetrievalQueries] (
[QueryId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ProjectId] nvarchar(64) NOT NULL,
[RunId] uniqueidentifier NULL,
[QueryHash] nvarchar(128) NOT NULL,
[FiltersJson] nvarchar(2000) NOT NULL,
[IndexesUsedJson] nvarchar(2000) NOT NULL,
[ResultCount] int NOT NULL,
[CitationsRef] nvarchar(512) NOT NULL,
[LatencyMs] int NOT NULL,
[ExecutedAt] datetimeoffset NOT NULL,
CONSTRAINT [PK_RetrievalQueries] PRIMARY KEY ([QueryId])
);
CREATE INDEX [IX_RetrievalQueries_Run] ON [dbo].[RetrievalQueries] ([RunId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
QueryId |
uniqueidentifier |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
ProjectId |
nvarchar(64) |
no | ||
RunId |
uniqueidentifier |
yes | ||
QueryHash |
nvarchar(128) |
no | ||
FiltersJson |
nvarchar(2000) |
no | ||
IndexesUsedJson |
nvarchar(2000) |
no | ||
ResultCount |
int |
no | ||
CitationsRef |
nvarchar(512) |
no | ||
LatencyMs |
int |
no | ||
ExecutedAt |
datetimeoffset |
no |