-- Создание пользователей и выдача им прав

create user readonly_user with password '123';
grant usage on schema public to readonly_user;
grant select on sportsman_requests_series_count to readonly_user;

create user edit_user with password '123';
grant usage on schema public to edit_user;
grant select on sportsman_requests_series_count to edit_user;
grant select, insert, update, delete on sportsman to edit_user;
grant select, insert, update, delete on participant_request to edit_user;
grant select, insert, update, delete on shot_series to edit_user;
grant usage, select on sequence sportsman_id_sportsman_seq to edit_user;
grant usage, select on sequence participant_request_id_participant_request_seq to edit_user;
grant usage, select on sequence shot_series_id_shot_series_seq to edit_user;