Database Schema (Current)
This diagram reflects the current database schema as of December 2024.
dsn~plantuml-database-model-current~1
Entity Categories
| Category |
Color |
Description |
| Core |
White |
Main business entities (User, Child, Location, Group) |
| Auth |
Blue |
Authentication and authorization |
| Messaging |
Green |
Communication system (Letters, Messages) |
| Documents |
Gray |
Documents and News |
| Staging |
Yellow |
Intranet sync staging tables |
Key Relationships
User-Child Relationships
- Many-to-many via
user_children join table
- Includes
relationship_role (mother, father, guardian, etc.)
- Validity period with
valid_from and valid_until
Organizational Hierarchy
Location
└── Group (many)
└── Child (many, via group_id)
└── Teacher (many, via group_teachers)
Staff Assignments
group_teachers: Assigns employees to groups
Group.lead_id: Group leader assignment
Location.lead_id / lead_2nd_id: Location leadership
ExternalID Mapping
The following app tables have external_id for intranet sync:
- Location.external_id ← SyncLocation.einrichtungs_id
- Group.external_id ← SyncGroup.gruppen_id
- Child.external_id ← SyncPerson.external_id
Staging Tables Data Flow
Intranet API Processing App Tables
─────────────────────────────────────────────────────────────────────────
SyncLocation ──────────────────────────────▶ Location
SyncGroup ──────────────────────────────▶ Group
SyncPerson (child) ──────────────────────────────▶ Child
SyncBelegung ──────────────────────────────▶ Child.group_id
SyncEmployee ─┐
SyncPerson (parent) ─┼── Used by Registration ──▶ User
SyncParentChild ─┤ ▶ UserChild
SyncLocationLead ─┤ ▶ Location.lead_id
SyncGroupLead ─┘ ▶ Group.lead_id
Changelog vs Original Schema
Added Tables
APIToken - Intranet API authentication
UserChild - Enhanced user-child relationship with metadata
AbsenceNotification - Parent absence notifications
MessageTemplate - Reusable message templates
- All
Sync* staging tables (9 tables)
SyncProcessingLog - Processing audit trail
Added Fields
Child.external_id - Intranet mapping
Group.external_id - Intranet mapping
Location.external_id - Intranet mapping
Child.valid_from, valid_until - Contract validity
User.language - Language preference
- Various
*_edited_by, *_edited_at audit fields
Renamed/Clarified
ChildUserMapping → UserChild (with additional fields)
GroupTeacher → group_teachers (GORM convention)
GroupChildren → group_children (GORM convention)
Needs: impl, utest, itest
Covers: