Entity-Relationship Diagram
The following diagram shows all tables and their primary relationships.Core Tables
The database schema is organized into four domains: authentication, authorization, project/environment management, and content.Authentication
Authorization
Project and Environment
Content
Document Table Columns
Thedocuments table is the central content table. Each row represents the current draft state of a single document.
Content Lifecycle
MDCMS uses a two-table model for content management. Thedocuments table holds the mutable head (working copy), while documentVersions holds immutable publish snapshots. This separation enables draft editing without affecting published content.
State Machine
State Transitions
Published versions are never modified or deleted. The
documentVersions
table is append-only, providing a complete audit trail of every publication.Concurrency Control
MDCMS uses optimistic concurrency via thedraftRevision column. Every write request must include the current draftRevision value. The server atomically increments the revision on update and rejects any request whose revision does not match the current database value.
Localization Architecture
MDCMS implements localization through translation groups — a logical grouping of locale-specific document variants that represent the same content in different languages.Translation Groups
ThetranslationGroupId column links all locale variants of a document. When you create a translation, a new documents row is created with:
- The same
translationGroupIdas the source document - A different
localevalue - Independent
body,frontmatter,publishedVersion, and lifecycle state
Default Locale
Content types that are not localized (nolocalized: true in the schema definition) use the sentinel locale value __mdcms_default__. This ensures a consistent data model regardless of whether a type supports multiple languages.
Locale Normalization
MDCMS normalizes all locale values to BCP 47 format (e.g.,en-US, fr-FR, ja). The normalization is applied at write time, ensuring consistent locale handling across the API, CLI, and Studio.