Skip to content

Latest commit

 

History

History
78 lines (48 loc) · 909 Bytes

File metadata and controls

78 lines (48 loc) · 909 Bytes

RLS Policies

Users

SELECT

auth_userid() = users.id OR json_extract(auth_json(), '$.name') = 'coach'

INSERT

auth_userid() = NEW.id

UPDATE

No policy

DELETE

No policy


Activities

SELECT

auth_userid() = activities.user_id OR json_extract(auth_json(), '$.name') = 'coach'

INSERT

auth_userid() = NEW.user_id

UPDATE

No policy

DELETE

auth_userid() = OLD.user_id OR json_extract(auth_json(), '$.name') = 'coach'

Workouts

SELECT

auth_userid() = workouts.user_id OR json_extract(auth_json(), '$.name') = 'coach'

INSERT

json_extract(auth_json(), '$.name') = 'coach'

UPDATE

OLD.user_id = auth_userid() OR json_extract(auth_json(), '$.name') = 'coach'

DELETE

json_extract(auth_json(), '$.name') = 'coach'