Fixing database script and adding information...

This commit is contained in:
2025-05-12 12:43:34 +02:00
parent 8ebb72b4e6
commit 53f488e40c
2 changed files with 16 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ create table training (
constraint fk_account foreign key (account) references account(id)
);
create view dailylift as select
date_trunc('day', time) as time, account, exercise, sum(runs * reps * kilos) as lift
date(time) as time, account, exercise, sum(runs * reps * kilos) as lift
from training group by 1, 2, 3;

View File

@@ -62,4 +62,18 @@ When travelling you might opt for specifying a specific location on the command
TZ=Australia/Sydney train squat 3 10 60
```
Data in the database can be visualized with, for example, Grafana, more info to follow.
Grafana Visaulisation
=====================
In `grafana/training-dashboard.json` a small dashboard is presented, a Postgres data source
must be defined, and the data base user must have access to select from tables in the training database.
```
grant select on account to grafana_query;
grant select on training to grafan_query;
grant select on exercise to grafan_query;
grant select on dailylist to grafan_query;
```