-
Notifications
You must be signed in to change notification settings - Fork 0
08 02 Database Schema
FractalDataWorks uses a SQL Server database project (sqlproj) to manage the configuration database schema. This page documents the schema structure and deployment approach.
The ConfigurationDb database contains 84 tables across 9 schemas, storing all FDW configuration including connections, datasets, authentication, scheduling, and TypeCollection metadata.
| Schema | Tables | Purpose |
|---|---|---|
| auth | 2 | User authentication (credential verification) |
| tenant | 5 | Multi-tenancy (tenants, user-tenant mappings, features, settings) |
| cfg | 66 | Core configuration for service domains |
| etl | 2 | ETL pipeline execution history |
| sched | 1 | Schedule execution tracking |
| ops | 3 | Operations (execution items, events, workflows) |
| types | 3 | TypeCollection metadata for runtime discovery |
| dq | 1 | Data quality check results |
| devOnly | 1 | Development-only credentials (non-production) |
The cfg schema follows the ManagedConfiguration pattern where parent tables store common fields and child tables store type-specific fields.
| Table | Description |
|---|---|
Connection |
Base table with Id, Name, ServiceOptionType, IsCurrent, IsDeleted |
MsSqlConnection |
SQL Server: Server, Database, Encrypt, TrustServerCertificate |
HttpConnection |
HTTP/REST: BaseUrl, TimeoutSeconds, DefaultHeaders |
OdbcConnection |
ODBC: ConnectionString, DriverName |
PostgreSqlConnection |
PostgreSQL: Host, Port, Database, SslMode |
| Table | Description |
|---|---|
SecretManager |
Base table for secret storage backends |
KeyVaultSecretManager |
Azure Key Vault: VaultUri, TenantId, ClientId |
| Table | Description |
|---|---|
Authentication |
Base table for auth providers |
BasicAuthentication |
Username/password credentials |
ApiKeyAuthentication |
API key with header name |
OAuth2Authentication |
OAuth2/OIDC: TokenEndpoint, ClientId, Scope |
JwtAuthentication |
JWT: Issuer, Audience, SigningKey |
| Table | Description |
|---|---|
DataSet |
Base table with Name, DataStoreId, ServiceOptionType |
StandardDataSet |
Single-source dataset configuration |
FederatedDataSet |
Multi-source with strategy (Union, Merge, etc.) |
CompoundDataSet |
Nested/hierarchical dataset structure |
DataSetSource |
Maps datasets to their data sources |
| Table | Description |
|---|---|
DataStoreConfiguration |
Physical data store locations |
DataPath |
Navigation paths within stores |
DataPathSegment |
Individual path segments |
DataContainer |
Physical schema definitions |
DataContainerField |
Field definitions with type, role, constraints |
| Table | Description |
|---|---|
ResiliencyPolicy |
Retry, circuit breaker policies |
Notification |
Notification channel configuration |
Transformation |
Data transformation definitions |
Workflow |
Workflow definitions |
ConfigurationAudit |
Audit trail for configuration changes |
The auth schema stores user credentials with restricted access (SELECT only for fdw_auth login).
| Table | Description |
|---|---|
Users |
User accounts with password hashes |
UserRoles |
User-role assignments |
The tenant schema stores multi-tenancy configuration with restricted access (SELECT only for fdw_tenant login).
| Table | Description |
|---|---|
Tenants |
Tenant definitions (slug, display name, branding) |
UserTenants |
User-tenant memberships |
TenantRoles |
Roles available in each tenant |
TenantFeatures |
Feature flags per tenant |
TenantSettings |
Per-tenant configuration key/value pairs |
| Table | Description |
|---|---|
PipelineExecution |
Execution history with status, timing, row counts |
ScheduleExecution |
ETL-specific schedule execution tracking |
| Table | Description |
|---|---|
ScheduleExecution |
Execution history with status, duration |
| Table | Description |
|---|---|
ExecutionItem |
Execution item tracking (workflows, jobs, stages, steps, tasks) |
ExecutionEvent |
Events and state transitions for execution items |
WorkflowExecution |
Workflow instance tracking with step progress |
The types schema enables runtime TypeCollection discovery from the database.
| Table | Description |
|---|---|
TypeCollection |
Collection definitions (FilterOperators, ConnectionTypes, etc.) |
TypeOption |
Individual options within collections |
TypeProperty |
Properties of each TypeOption for reflection |
The schema is managed as a SQL Server Database Project using Microsoft.Build.Sql SDK 2.0.0.
public/databases/
├── ControlDb.sqlproj # Project file
├── auth/
│ ├── auth.sql # CREATE SCHEMA auth
│ └── Tables/ # 2 .sql files (Users, UserRoles)
├── tenant/
│ ├── tenant.sql # CREATE SCHEMA tenant
│ └── Tables/ # 5 .sql files (Tenants, UserTenants, TenantRoles, etc.)
├── cfg/
│ ├── cfg.sql # CREATE SCHEMA cfg
│ └── Tables/ # 66 .sql files
├── etl/
│ ├── etl.sql
│ └── Tables/
├── sched/
│ ├── sched.sql
│ └── Tables/
├── ops/
│ ├── ops.sql
│ └── Tables/ # 3 .sql files
├── types/
│ ├── types.sql
│ └── Tables/
└── Security/
├── logins.sql # Service-specific SQL logins
├── permissions.sql # Schema-level permission grants
└── rls-users.sql # Row-Level Security policies
cd public/databases
dotnet build -c Release
# Output: bin/Release/ControlDb.dacpacEach table file follows this structure:
CREATE TABLE [schema].[TableName]
(
[Id] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID(),
[Name] NVARCHAR(200) NOT NULL,
-- columns...
[IsCurrent] BIT NOT NULL DEFAULT 1,
[IsDeleted] BIT NOT NULL DEFAULT 0,
CONSTRAINT [PK_TableName] PRIMARY KEY ([Id]),
CONSTRAINT [FK_...] FOREIGN KEY (...) REFERENCES ...
);
GO
CREATE INDEX [IX_TableName_Column] ON [schema].[TableName]([Column]);
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'Description of the table',
@level0type = N'SCHEMA', @level0name = N'schema',
@level1type = N'TABLE', @level1name = N'TableName';
GO- GO separators - Required between each statement
- Extended properties - MS_Description on tables and columns
- Standard columns - IsCurrent, IsDeleted for soft-delete pattern
-
Parent-child FKs - Child tables reference parent via
{ParentName}Idcolumn - Naming - PK_Table, FK_Child_Parent, IX_Table_Column, UQ_Table_Column
The Reference Solution deploys the schema via dacpac in Docker:
cd ReferenceSolutions/ApiSolution
# Build dacpac
./docker/mssql/build-dacpac.ps1
# Deploy to Docker
docker-compose -f docker-compose.dacpac.yml up -dThe Docker image includes SqlPackage for dacpac deployment, with seed data applied afterward.
- ManagedConfiguration - How configuration classes map to tables
- Schema Abstractions - Unified schema definitions
- Reference Solutions Architecture - Full solution overview