adding message functionality, changed args layout

This commit is contained in:
2025-05-13 22:28:39 +02:00
parent bd74c2897f
commit bde98e4785
2 changed files with 87 additions and 40 deletions

View File

@@ -24,14 +24,22 @@ create table training (
constraint fk_exercise foreign key (exercise) references exercise(id),
constraint fk_account foreign key (account) references account(id)
);
create table message (
id serial primary key,
account integer not null,
time timestamptz not null default timezone('utc', now()),
message varchar not null,
constraint fk_account foreign key (account) references account(id)
);
create view dailylift as select
date(time) as time, account, exercise, sum(runs * reps * kilos) as lift
from training group by 1, 2, 3;
create role training_user;
grant select on account to create_user;
grant select on exercise to create_user;
grant select on shorthand to create_user;
grant insert on training to create_user;
grant select on training to create_user;
grant usage on training_id_seq to create_user;
grant select on account to training_user;
grant select on exercise to training_user;
grant select on shorthand to training_user;
grant insert on training to training_user;
grant select on training to training_user;
grant insert on message to training_user;
grant usage on training_id_seq to training_user;