added demo account data seeding

This commit is contained in:
Joren de Graaf
2026-09-30 18:01:34 +02:00
parent 6baa19f11b
commit d891aa65cc
19 changed files with 493 additions and 69 deletions
+28
View File
@@ -16,3 +16,31 @@ Deferral precedence is: manual, missed, and Sick Day state are evaluated before
## Legacy ownership migration
Migration `0006` assigns old unowned tasks only when the database has exactly one active user. This local development database met that condition and its two existing tasks were assigned to that account. In a multi-user deployment the migration deliberately leaves legacy rows unowned instead of guessing; claim them explicitly before making ownership non-null at the database level.
## Demo account reset
Create or reset the public demonstration account and its dummy data with:
```sh
/home/jorenmartijn/django/tasksnest/bin/python /home/jorenmartijn/django/main/manage.py seed_demo
```
The command resets only the `demo` account (default password: `demo`). It creates
sample parent/subtasks, workouts, pain and sleep check-ins, and a 16-hour fasting
schedule. It is idempotent: running it again removes demo-only edits and restores
the same baseline. Use `--username` and `--password` to override the credentials.
A daily systemd timer template is provided in `main/deploy/systemd/`. Adjust the
`User`, `WorkingDirectory`, and `ExecStart` paths in the service file if needed,
then install it with:
```sh
sudo cp main/deploy/systemd/tasknest-demo-seed.service /etc/systemd/system/
sudo cp main/deploy/systemd/tasknest-demo-seed.timer /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now tasknest-demo-seed.timer
systemctl list-timers tasknest-demo-seed.timer
```
The supplied timer runs daily at 03:15 Europe/Amsterdam and catches up after a
missed scheduled run when the host comes back online.