camper/deploy/cancel_booking.sql

24 lines
597 B
MySQL
Raw Normal View History

2024-05-03 15:21:20 +00:00
-- 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;