Wiki/baserow/seed/README.md
Corentin JOGUET 6724be6c85
Some checks are pending
CI / Lint bridge (Biome) (push) Waiting to run
CI / Type-check bridge (push) Blocked by required conditions
CI / Tests unit bridge (push) Blocked by required conditions
CI / Tests integration bridge (push) Blocked by required conditions
CI / Security scan (push) Waiting to run
CI / Docker build + healthcheck (push) Blocked by required conditions
feat(baserow): add seed script + Fast-App iteration 1 artifacts
- baserow/seed/schema.json : 9 tables declaratif (personne + CFA + Agence)
- baserow/seed/seed.py : Python script idempotent (login + workspace + db + tables + fields + links)
- baserow/seed/requirements.txt : requests
- baserow/seed/README.md : quickstart 4 etapes
- Makefile target seed-baserow

Fast-App workflow local :
- _byan-output/fast-app/formation-hub/ : 6 artifacts (pitch, backlog, cdcf-stories, plan, dispatch, build-state)
- Phase 0 mappee : phases 1-6 done depuis docs Merise/UML existants
- Iteration 1 BUILD = setup tables Baserow vanilla (S-02 + S-03 + S-04)

Stack locale up et healthy. Pret pour seed apres creation compte admin Baserow.
2026-05-07 17:37:55 +02:00

86 lines
2.6 KiB
Markdown

# Baserow seed
Cree les 9 tables `formation-hub` dans Baserow via l'API. Idempotent — skip ce qui existe.
## Quickstart (4 etapes, ~5 min)
### 1. Creer le compte admin Baserow (premier boot — manuel UI)
Aller sur **http://localhost:8080**. La premiere page propose de creer un compte. Remplir :
- Workspace name : `Acadenice`
- Email : `admin@acadenice.fr` (ou autre admin)
- Password : password robuste (a sauvegarder dans pass/vault)
### 2. Pre-requis Python
```bash
cd baserow/seed
pip install -r requirements.txt
# OU si tu prefere : python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
```
### 3. Run le seed
```bash
BASEROW_URL=http://localhost:8080 \
BASEROW_EMAIL=admin@acadenice.fr \
BASEROW_PASSWORD='ton-password' \
python baserow/seed/seed.py
```
Output attendu :
```
[1/5] Login http://localhost:8080
[auth] Logged in as admin@acadenice.fr
[2/5] Workspace 'Acadenice'
[workspace] Reuse 'Acadenice' id=1
[3/5] Database 'formation-hub'
[db] Created 'formation-hub' id=1
[4/5] Tables + primitive fields
[table] Created 'personne' id=1
[field] Created 'personne_prenom' (text)
...
[5/5] Link fields (2nd pass)
[link] Created bloc.bloc_formation -> formation
...
=== Seed OK ===
Workspace: Acadenice
Database : formation-hub
Tables : 9
Links : 10
```
### 4. Verifier dans l'UI
Ouvrir http://localhost:8080, naviguer dans le workspace **Acadenice** → database **formation-hub** → 9 tables doivent etre presentes avec leurs champs et liens.
## Re-runnable
Le script est **idempotent**. Tu peux le relancer apres modifications du schema — il ne recree pas ce qui existe deja.
Pour reset complet : drop la database via l'UI Baserow, puis relancer.
## Schema
`schema.json` decrit les 9 tables + 10 liens FK. Format JSON declaratif, modifiable.
Les **formulas** (rollups, heures_restantes, etc.) ne sont **pas** crees par ce seed (Phase 1 = structure seule). Elles seront ajoutees en iteration 2 du plan Fast-App via un seed-formulas.py separe.
## Troubleshooting
| Symptome | Cause probable | Fix |
|----------|----------------|-----|
| `401 Unauthorized` | Mauvais email/password | Verifier BASEROW_EMAIL et BASEROW_PASSWORD |
| `400 Bad Request` sur field | Type non supporte version Baserow | Voir logs detail, ajuster `_field_to_payload` |
| Field deja existant | Idempotent OK | Aucune action |
| Tables creees mais vides | Normal — pas de seed data Phase 1 | Sera ajoute iteration 6 (migration data) |
## References
- Baserow API doc : https://baserow.io/api-docs
- Doc 15 MPD (mapping fields → Baserow types) : `docs/15-baserow-mpd.md`