Skip to content

Database Schema Reference

Status: Implemented

Overview

This document is the authoritative reference for the database structures currently implemented in the Nivron platform.

It describes schemas, tables, relationships and migration ownership while serving as the primary implementation reference for developers and platform maintainers.


Database Schemas

Schema Purpose
core Platform metadata and organizational foundation.
identity Identity and access entities.

Table: core.platform_metadata

Purpose

Stores metadata describing the running platform instance.

Main Columns

Column Description
product Product name.
component Running component.
version Software version.
environment Runtime environment.

Table: core.organizations

Purpose

Represents an organization (tenant) managed by the platform.

Main Columns

Column Description
id Internal numeric identifier.
uuid Public UUID v7 identifier.
slug Unique organization slug.
name Display name.
status Lifecycle status.
created_at Creation timestamp.
updated_at Last modification timestamp.

Table: identity.users

Purpose

Represents platform users associated with an organization.

Main Columns

Column Description
id Internal numeric identifier.
uuid Public UUID v7 identifier.
organization_id References core.organizations.
username Login name.
status User lifecycle status.
created_at Creation timestamp.
updated_at Last modification timestamp.

Entity Relationships

erDiagram
    ORGANIZATIONS ||--o{ USERS : owns

    ORGANIZATIONS {
        bigint id
        uuid uuid
    }

    USERS {
        bigint id
        bigint organization_id
        uuid uuid
    }

Migration History

The current schema is established through immutable Alembic migrations:

Migration Responsibility
0001_platform_schemas Create platform schemas.
0002_core_platform_metadata Platform metadata table.
0003_core_organizations Organizations model.
0004_identity_users Users model.

Design Principles

  • Domain-oriented schemas.
  • Immutable database migrations.
  • UUID v7 for external identifiers.
  • Tenant-first data model.
  • Backward-compatible schema evolution.