13 lines
428 B
SQL
13 lines
428 B
SQL
-- The overlap exclusion constraint must not apply to cancelled reservations,
|
|
-- so that a cancelled slot can be re-booked by another member.
|
|
|
|
alter table public.reservations
|
|
drop constraint no_overlapping_reservations;
|
|
|
|
alter table public.reservations
|
|
add constraint no_overlapping_reservations
|
|
exclude using gist (
|
|
boat_id with =,
|
|
tstzrange(start_time, end_time, '[)') with &&
|
|
) where (status <> 'cancelled');
|