Data Model

Source of Truth

The relational database behind ft-configs-service is the source of truth for all configuration domains. Hazelcast is used for distributing derived read models, not for primary storage.

Schema Management

  • Liquibase master changelog: src/main/resources/db/changelog/db.changelog-master.yaml

  • Individual change logs: src/main/resources/db/changelog/*.xml (see the include list in the master file)

  • JPA is configured to validate schema on startup in non-test profiles (spring.jpa.hibernate.ddl-auto=validate).

Cross-cutting Modeling Rules

Partitioning by ClientType

Many domains are partitioned by ClientType (mc, sc, def) using an enum stored as string in DB tables and used as Hazelcast map keys. Example: TabGroup.clientType stored as angular_tab_group.client_type (src/main/java/com/friendly/ftconfigsservice/angular/tabs/TabGroup.java).

Auditing columns

Many entities use Spring Data auditing fields (created_at, created_by, updated_at, updated_by) via @EntityListeners(AuditingEntityListener.class) and the AuditorAware bean in AuditConfig.

Identifier Strategy (MySQL + Oracle)

Most entities use @SmartIdGeneration (src/main/java/com/friendly/ftconfigsservice/utils/idgenerator/SmartIdGeneration.java), backed by a Hibernate generator:

  • MySQL: IDENTITY / auto-increment (generator returns null so DB assigns the key).

  • Oracle: sequence-based pre-insert IDs with sequence naming convention {TABLE_NAME}_0 (uppercased table name).

Core Entities (examples)

This section highlights a few aggregates that are commonly referenced by API, caching and operational flows.

Authentication

  • users table: UserEntity (src/main/java/com/friendly/ftconfigsservice/auth/UserEntity.java)

  • refresh_tokens table: RefreshToken (src/main/java/com/friendly/ftconfigsservice/auth/RefreshToken.java)

Relationships:

  • refresh_tokens.user_id → users.id (many refresh tokens per user)

Tabs (domain “tabs”)

  • angular_tab_group table: TabGroup

  • angular_tab_item table: TabItem (hierarchical parent-child under a group)

Constraints:

  • Unique group key: (angular_tab_group.path, angular_tab_group.client_type) (uk_tab_group_client_type_path)

Northbound configuration

Tables and entities:

  • northbound_config_group: NorthboundConfigGroup

  • northbound_config_entry: NorthboundConfigEntry (belongs to a group; unique code)

  • northbound_config_alias: NorthboundConfigAlias (maps legacy/properties keys to canonical entries)

  • northbound_config_*_translation: translation tables for groups and entries

Audit

  • audit_event: AuditEventEntity (one row per audited operation)

  • audit_snapshot: AuditSnapshotEntity (deduplicated JSON entity snapshots, shared via content-hash)

  • audit_event_snapshot: AuditEventSnapshotEntity (junction table linking events to snapshots with BEFORE/AFTER role)

  • audit_change: AuditChangeEntity (field-level change records for UPDATE operations)

ER Diagram (selected tables)

ft-configs-er-selected