-- Deploy camper:location to pg -- requires: schema_camper -- requires: roles -- requires: company -- requires: user_profile begin; set search_path to camper, public; create table location ( company_id integer primary key references company, directions xml not null, map_embed xml not null, opening_dates xml not null ); grant select on table location to guest; grant select on table location to employee; grant select, insert, update, delete on table location to admin; alter table location enable row level security; create policy guest_ok on location for select using (true) ; create policy insert_to_company on location for insert with check ( company_id in (select company_id from user_profile) ) ; create policy update_company on location for update using ( company_id in (select company_id from user_profile) ) ; create policy delete_from_company on location for delete using ( company_id in (select company_id from user_profile) ) ; commit;