24 lines
597 B
PL/PgSQL
24 lines
597 B
PL/PgSQL
-- Deploy camper:cancel_booking to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
-- requires: booking
|
|
-- requires: booking_campsite
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function cancel_booking(bid integer) returns void as
|
|
$$
|
|
delete from booking_campsite where booking_id = bid;
|
|
update booking set booking_status = 'cancelled' where booking_id = bid;
|
|
$$
|
|
language sql
|
|
;
|
|
|
|
revoke execute on function cancel_booking(integer) from public;
|
|
grant execute on function cancel_booking(integer) to employee;
|
|
grant execute on function cancel_booking(integer) to admin;
|
|
|
|
commit;
|