Skip to content

MarketplaceCatalogService — 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.Listings

Owner: Listing

CREATE TABLE [dbo].[Listings] (
    [ListingId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [PublisherId] uniqueidentifier NOT NULL,
    [Kind] int NOT NULL,
    [AssetId] nvarchar(128) NOT NULL,
    [ReleaseId] nvarchar(256) NOT NULL,
    [EvidenceRef] nvarchar(512) NOT NULL,
    [CompatibilityJson] nvarchar(2000) NOT NULL,
    [DependenciesJson] nvarchar(2000) NOT NULL,
    [PricingRef] uniqueidentifier NULL,
    [Visibility] int NOT NULL,
    [State] int NOT NULL,
    [DocumentRefsJson] nvarchar(2000) NOT NULL,
    [ListedAt] datetimeoffset NULL,
    CONSTRAINT [PK_Listings] PRIMARY KEY ([ListingId])
);
CREATE UNIQUE INDEX [UX_Listings_Asset_Release] ON [dbo].[Listings] ([AssetId], [ReleaseId]);
CREATE INDEX [IX_Listings_Kind_State_Visibility] ON [dbo].[Listings] ([Kind], [State], [Visibility]);
Column Type Null Key Description
ListingId uniqueidentifier no PK
TenantId nvarchar(64) no
PublisherId uniqueidentifier no
Kind int no
AssetId nvarchar(128) no
ReleaseId nvarchar(256) no
EvidenceRef nvarchar(512) no
CompatibilityJson nvarchar(2000) no
DependenciesJson nvarchar(2000) no
PricingRef uniqueidentifier yes
Visibility int no
State int no
DocumentRefsJson nvarchar(2000) no
ListedAt datetimeoffset yes

dbo.ListingDependencies

Owner: Listing

CREATE TABLE [dbo].[ListingDependencies] (
    [ListingId] uniqueidentifier NOT NULL,
    [DependsOnListingId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [VersionRange] nvarchar(64) NOT NULL,
    CONSTRAINT [PK_ListingDependencies] PRIMARY KEY ([ListingId], [DependsOnListingId])
);
ALTER TABLE [dbo].[ListingDependencies] ADD CONSTRAINT [FK_ListingDependencies_Listings_ListingId] FOREIGN KEY ([ListingId]) REFERENCES [dbo].[Listings] ([ListingId]);
Column Type Null Key Description
ListingId uniqueidentifier no PK FK → Listings.ListingId
DependsOnListingId uniqueidentifier no PK
TenantId nvarchar(64) no
VersionRange nvarchar(64) no

dbo.Installations

Owner: Installation

CREATE TABLE [dbo].[Installations] (
    [InstallationId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ProjectId] nvarchar(64) NULL,
    [ListingId] uniqueidentifier NOT NULL,
    [ReleaseId] nvarchar(256) NOT NULL,
    [EntitlementId] uniqueidentifier NULL,
    [State] int NOT NULL,
    [InstalledBy] nvarchar(256) NOT NULL,
    [InstalledAt] datetimeoffset NULL,
    [UpdateAvailableReleaseId] nvarchar(256) NULL,
    CONSTRAINT [PK_Installations] PRIMARY KEY ([InstallationId])
);
ALTER TABLE [dbo].[Installations] ADD CONSTRAINT [FK_Installations_Listings_ListingId] FOREIGN KEY ([ListingId]) REFERENCES [dbo].[Listings] ([ListingId]);
CREATE UNIQUE INDEX [UX_Installations_Scope_Listing] ON [dbo].[Installations] ([TenantId], [ProjectId], [ListingId]);
Column Type Null Key Description
InstallationId uniqueidentifier no PK
TenantId nvarchar(64) no
ProjectId nvarchar(64) yes
ListingId uniqueidentifier no FK → Listings.ListingId
ReleaseId nvarchar(256) no
EntitlementId uniqueidentifier yes
State int no
InstalledBy nvarchar(256) no
InstalledAt datetimeoffset yes
UpdateAvailableReleaseId nvarchar(256) yes