Skip to content

EnvironmentService — 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.Environments

Owner: Environment

CREATE TABLE [dbo].[Environments] (
    [EnvironmentId] uniqueidentifier NOT NULL,
    [ProjectId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [Name] nvarchar(64) NOT NULL,
    [Class] int NOT NULL,
    [State] int NOT NULL,
    [Region] nvarchar(32) NOT NULL,
    [DesiredDeploymentRef] nvarchar(256) NULL,
    [Version] rowversion NOT NULL,
    CONSTRAINT [PK_Environments] PRIMARY KEY ([EnvironmentId])
);
CREATE UNIQUE INDEX [UX_Environments_Project_Name] ON [dbo].[Environments] ([ProjectId], [Name]);
Column Type Null Key Description
EnvironmentId uniqueidentifier no PK
ProjectId uniqueidentifier no
TenantId nvarchar(64) no
Name nvarchar(64) no
Class int no
State int no
Region nvarchar(32) no
DesiredDeploymentRef nvarchar(256) yes
Version rowversion no

dbo.EnvironmentConnections

Owner: Environment

CREATE TABLE [dbo].[EnvironmentConnections] (
    [EnvironmentId] uniqueidentifier NOT NULL,
    [ConnectionId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    CONSTRAINT [PK_EnvironmentConnections] PRIMARY KEY ([EnvironmentId], [ConnectionId])
);
ALTER TABLE [dbo].[EnvironmentConnections] ADD CONSTRAINT [FK_EnvironmentConnections_Environments_EnvironmentId] FOREIGN KEY ([EnvironmentId]) REFERENCES [dbo].[Environments] ([EnvironmentId]);
Column Type Null Key Description
EnvironmentId uniqueidentifier no PK FK → Environments.EnvironmentId
ConnectionId uniqueidentifier no PK
TenantId nvarchar(64) no