docs: migrer schémas BDD de Mermaid vers DBML
Remplace les diagrammes Mermaid par DBML (via kroki-dbml) pour une meilleure expressivité des schémas de base de données : - Ajout support notes, contraintes et indexes détaillés - Migration de tous les schémas d'entités partagées - Ajout fichier exemple dbml-example.md - Configuration plugin mkdocs-kroki pour rendu DBML
This commit is contained in:
@@ -4,22 +4,37 @@
|
||||
|
||||
## Diagramme
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
USERS ||--o{ LOCATION_HISTORY : "génère"
|
||||
```kroki-dbml
|
||||
Table users {
|
||||
id uuid [primary key]
|
||||
}
|
||||
|
||||
LOCATION_HISTORY {
|
||||
uuid id PK
|
||||
uuid user_id FK
|
||||
geography location
|
||||
string geohash
|
||||
boolean anonymized
|
||||
string context
|
||||
float speed_kmh
|
||||
float accuracy_meters
|
||||
timestamp created_at
|
||||
timestamp anonymized_at
|
||||
}
|
||||
Table location_history {
|
||||
id uuid [primary key]
|
||||
user_id uuid [not null, ref: > users.id]
|
||||
location geography [note: 'PostGIS geography type: POINT with SRID 4326 (WGS84)']
|
||||
geohash varchar(12) [note: 'Precision 5 geohash (~5km²) after anonymization']
|
||||
anonymized boolean [not null, default: false, note: 'true after 24h auto-anonymization']
|
||||
context location_context_enum [not null]
|
||||
speed_kmh float [note: 'GPS speed in km/h (NULL if stationary)']
|
||||
accuracy_meters float [not null, note: 'GPS accuracy radius in meters']
|
||||
created_at timestamp [not null, default: `now()`]
|
||||
anonymized_at timestamp [note: 'When precise location was replaced by geohash']
|
||||
|
||||
indexes {
|
||||
(user_id, created_at) [note: 'User location timeline']
|
||||
(created_at, anonymized) [note: 'Daily anonymization job (WHERE anonymized = false AND created_at < NOW() - 24h)']
|
||||
(location) [type: gist, note: 'PostGIS spatial index for proximity queries']
|
||||
(geohash) [note: 'Analytics queries on anonymized data']
|
||||
}
|
||||
}
|
||||
|
||||
Enum location_context_enum {
|
||||
listening [note: 'Position pendant écoute de contenu']
|
||||
search [note: 'Position lors d une recherche']
|
||||
background [note: 'Tracking en arrière-plan']
|
||||
manual [note: 'Position partagée manuellement']
|
||||
}
|
||||
```
|
||||
|
||||
## Légende
|
||||
|
||||
Reference in New Issue
Block a user