The two questions
Everything here answers one of two questions: how do I not lose data (backups, safe updates), and how do I get data back (restore, merge).
Backups
A project is a folder: copying
tenants\<tenant>\<project>\ backs up its history, graphics,
and source EDE. The platform-wide set is that folder tree plus
data\minibms.db and config.json. For a hot copy of the central
database while the platform runs, use SQLite's online backup:
sqlite3 data\minibms.db ".backup backup.db". Updates via
update.bat never touch any of these paths.
Restore: a new installation takes over an old one's data
Use when a fresh folder should carry everything from a previous installation:
beez tools\manage.py restore --from C:\Dev\beez-minibms-OLD
Current data is moved to backup-before-restore-<timestamp>\ first,
then the old installation's data\, tenants\ and
config.json (bridges included) are copied in. Any schema generation is
accepted; migrations run automatically on the next start. Type RESTORE at the prompt, or
pass --yes in scripts.
Merge: pull old history into existing projects
Use when the projects already exist here and only the samples are missing, or to consolidate several old folders. In the Admin tab, Import history from a previous installation: paste the old path, Scan, review each found project with its slugs, point count, sample count, and date range, pick the target project (preselected on a slug match), Import. The result reports samples imported and points matched. The CLI equivalent:
beez tools\manage.py import-history --from C:\Dev\beez-minibms-OLD --project safra-sg-nrise
Matching is by site, equipment, and point id, never internal ids, so it works across reinstalls. The primary key on point and timestamp makes duplicates impossible: importing twice, or overlapping folders, is harmless. Safe while the platform is up.
Consolidating several old installations
Run restore from the newest old folder first, then
import-history from each older folder. The result is the union of all
history.