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
timestampcolumn (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 Name | Type | Description |
|---|---|---|
| consentId | varchar(255) | Unqiue UUID created for each consent individually (required) |
| action | varchar(255) | Action that was used to store the consent |
| appVersion | varchar(255) | Version of the CMP App |
| consentTemplateId | varchar(255) | "Service-ID" (previously called "Template-ID") of the service for which the consent was saved for |
| consentTemplateVersion | varchar(255) | Version of the text template of the service for which the consent was saved for |
| controllerId | varchar(255) | Unique UUID created for each user, stored in the browser's local storage |
| language | varchar(255) | Language of the text template of the service for which the consent was saved for |
| settingsId | varchar(255) | ID of the CMP-Configuration |
| settingsVersion | varchar(255) | Version of the CMP-Configuration |
| consentStatus | bool | Consent status (accept/deny) as boolean |
| timestamp | timestamp(6) | Timestamp that is automatically generated when the row is inserted |
Analytics
This table stores all interaction analytics data:
| Column Name | Type | Description |
|---|---|---|
| analytics_id | varchar(255) | Unique UUID created for each analytics row (required) |
| version | integer | Version identified (required) |
| settingsId | varchar(255) | ID of the CMP-Configuration (required) |
| event | integer | Event-Enum-Definition (required) |
| referrer | varchar(255) | Source of the analytics hit (required) |
| original_timestamp | bigint | Timestamp created from the Usercentrics frontend script (required) |
| abversion | varchar(255) | AB-Version-ID if AB-Testing is enabled |
| timestamp | timestamp(6) | Timestamp that is automatically generated when the row is inserted |
Sessions
This table stores session hits used to count user sessions:
| Column Name | Type | Description |
|---|---|---|
| settingsId | varchar(255) | ID of the CMP-Configuration (required) |
| timestamp | timestamp(6) | Timestamp that is automatically generated when the row is inserted |