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,26 +4,43 @@
|
||||
|
||||
## Diagramme
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
USERS ||--o{ DEVICES : "possède"
|
||||
DEVICES ||--o{ SESSIONS : "a"
|
||||
```kroki-dbml
|
||||
Table users {
|
||||
id uuid [primary key]
|
||||
}
|
||||
|
||||
DEVICES {
|
||||
uuid id PK
|
||||
uuid user_id FK
|
||||
string device_name
|
||||
string os
|
||||
string browser
|
||||
string device_type
|
||||
boolean is_trusted
|
||||
timestamp trusted_until
|
||||
timestamp first_seen_at
|
||||
timestamp last_seen_at
|
||||
inet last_ip
|
||||
string last_city
|
||||
string last_country_code
|
||||
}
|
||||
Table devices {
|
||||
id uuid [primary key]
|
||||
user_id uuid [not null, ref: > users.id]
|
||||
device_name varchar(255) [note: 'User-defined device name']
|
||||
os varchar(50) [note: 'iOS, Android, Windows, macOS, Linux']
|
||||
browser varchar(50) [note: 'Safari, Chrome, Firefox, etc.']
|
||||
device_type device_type_enum [not null, note: 'mobile, tablet, desktop, car']
|
||||
is_trusted boolean [not null, default: false, note: 'Bypass 2FA for 30 days if true']
|
||||
trusted_until timestamp [note: 'NULL if not trusted, expires after 30 days']
|
||||
first_seen_at timestamp [not null, default: `now()`]
|
||||
last_seen_at timestamp [not null, default: `now()`]
|
||||
last_ip inet [not null]
|
||||
last_city varchar(100)
|
||||
last_country_code char(2)
|
||||
|
||||
indexes {
|
||||
(user_id, last_seen_at) [note: 'List user devices by recent activity']
|
||||
(user_id, is_trusted) [note: 'Find trusted devices for user']
|
||||
}
|
||||
}
|
||||
|
||||
Table sessions {
|
||||
id uuid [primary key]
|
||||
device_id uuid [ref: > devices.id]
|
||||
}
|
||||
|
||||
Enum device_type_enum {
|
||||
mobile [note: 'Smartphone Android/iOS']
|
||||
tablet [note: 'Tablette']
|
||||
desktop [note: 'Ordinateur']
|
||||
car [note: 'Système embarqué (CarPlay/Android Auto)']
|
||||
}
|
||||
```
|
||||
|
||||
## Légende
|
||||
|
||||
Reference in New Issue
Block a user