125 lines
1.7 KiB
Markdown
125 lines
1.7 KiB
Markdown
# Structure BDD - MatosBox (reference)
|
|
|
|
## Base
|
|
- SQLite par defaut : `matosbox.db`
|
|
- Postgres optionnel : base `matosbox`
|
|
|
|
## Tables principales
|
|
|
|
### Objet
|
|
Champs :
|
|
- id
|
|
- nom
|
|
- description
|
|
- quantite
|
|
- prix_achat
|
|
- date_achat
|
|
- boutique
|
|
- numero_serie
|
|
- numero_modele
|
|
- fabricant
|
|
- statut (enum: en_stock, pret, hors_service, archive)
|
|
- caracteristiques (JSONB)
|
|
|
|
Relations :
|
|
- 1..n `PieceJointe`
|
|
- 1..n `ChampPersonnalise`
|
|
- n..n `Emplacement` via `LienObjetEmplacement`
|
|
|
|
### Categorie
|
|
Champs :
|
|
- id
|
|
- nom
|
|
- parent_id
|
|
- slug
|
|
- icone
|
|
|
|
Relations :
|
|
- auto-reference (parent/enfant)
|
|
|
|
### Emplacement
|
|
Champs :
|
|
- id
|
|
- nom
|
|
- parent_id
|
|
- slug
|
|
- piece
|
|
- meuble
|
|
- numero_boite
|
|
- icone
|
|
|
|
Relations :
|
|
- auto-reference (parent/enfant)
|
|
|
|
### LienObjetEmplacement
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- emplacement_id
|
|
- type (enum: stocke, utilise_dans)
|
|
|
|
### ChampPersonnalise
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- nom_champ
|
|
- type_champ (string/int/bool/date)
|
|
- valeur
|
|
- unite
|
|
|
|
### PieceJointe
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- nom_fichier
|
|
- chemin
|
|
- type_mime
|
|
- est_principale
|
|
- categorie (image/pdf_notice/markdown_tuto)
|
|
|
|
### HistoriqueAchat
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- boutique
|
|
- numero_commande
|
|
- prix
|
|
- date
|
|
- quantite
|
|
|
|
### Pret
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- a_utilisateur
|
|
- date_debut
|
|
- date_fin
|
|
- notes
|
|
|
|
### MouvementStock
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- delta_quantite
|
|
- raison
|
|
- date
|
|
|
|
### Garantie
|
|
Champs :
|
|
- id
|
|
- objet_id
|
|
- fournisseur
|
|
- duree_mois
|
|
- date_debut
|
|
- preuve (piece_jointe_id)
|
|
|
|
## Relations notables
|
|
- Arbres recursifs pour `Categorie` et `Emplacement`.
|
|
- Historique achats, prets et mouvements relies a `Objet`.
|
|
- Pieces jointes liees a `Objet`.
|
|
|
|
## Notes migration
|
|
- Migrations via Goose/Atlas.
|
|
- SQLite WAL a activer.
|
|
- Export/Import via CSV/JSON ou pgloader pour Postgres.
|