Skip to main content

Databases

The application supports the following databases:

  • PostgreSQL 18
  • Logonly-Proxy

Database Setup

Use the environment variables provided below to connect to a database system of your choice:

PostgreSQL

To use PostgreSQL, set the following environment variables:

DATABASE="postgres" #Specify, that postgres is used as main database

PGHOST="0.0.0.0" #Database host
PGPORT="5432" #Database port
PGDATABASE="uc_db" #Database name
PGSCHEMA="uc_db" #Database Schema
PGUSER="user" #User with write access to database
PGPASSWORD="password" #Password of the user

When using Postgres, we recommend to use our Postgres-Image (see Intro-Page). This image contains PostgreSQL-Server 18 with some advanced settings for security and partitioning:

  • Consent-Table is partitioned after timestamp column (daily)
  • A different tablespace is used to enhance security ('uc_db' at /uc_db)
  • A different schema is used to enhance security ('uc_db')

Logonly

For debug purposes, you can specify the Environment-Variable DATABASE="logonly". That way, the App will log all database hits to the console so they can be captured with a log-parsing tool. This solution should be only used for debugging purposes, but not for production usage.

Table Structure

All databases are structured identically and consists out of three tables:

Consents

This table stores all consent data:

Column NameTypeDescription
consentIdvarchar(255)Unqiue UUID created for each consent individually (required)
actionvarchar(255)Action that was used to store the consent
appVersionvarchar(255)Version of the CMP App
consentTemplateIdvarchar(255)"Service-ID" (previously called "Template-ID") of the service for which the consent was saved for
consentTemplateVersionvarchar(255)Version of the text template of the service for which the consent was saved for
controllerIdvarchar(255)Unique UUID created for each user, stored in the browser's local storage
languagevarchar(255)Language of the text template of the service for which the consent was saved for
settingsIdvarchar(255)ID of the CMP-Configuration
settingsVersionvarchar(255)Version of the CMP-Configuration
consentStatusboolConsent status (accept/deny) as boolean
timestamptimestamp(6)Timestamp that is automatically generated when the row is inserted

Analytics

This table stores all interaction analytics data:

Column NameTypeDescription
analytics_idvarchar(255)Unique UUID created for each analytics row (required)
versionintegerVersion identified (required)
settingsIdvarchar(255)ID of the CMP-Configuration (required)
eventintegerEvent-Enum-Definition (required)
referrervarchar(255)Source of the analytics hit (required)
original_timestampbigintTimestamp created from the Usercentrics frontend script (required)
abversionvarchar(255)AB-Version-ID if AB-Testing is enabled
timestamptimestamp(6)Timestamp that is automatically generated when the row is inserted

Sessions

This table stores session hits used to count user sessions:

Column NameTypeDescription
settingsIdvarchar(255)ID of the CMP-Configuration (required)
timestamptimestamp(6)Timestamp that is automatically generated when the row is inserted