-- Deploy camper:acsi_calendar to pg
-- requires: roles
-- requires: schema_camper
-- requires: acsi

begin;

set search_path to camper, public;

create table acsi_calendar (
	campsite_type_id integer not null references acsi,
	acsi_range daterange not null,
	primary key (campsite_type_id, acsi_range),
	constraint disallow_acsi_overlap exclude using gist (campsite_type_id with =, acsi_range with &&)
);

grant select on table acsi_calendar to guest;
grant select on table acsi_calendar to employee;
grant select, insert, update, delete on table acsi_calendar to admin;

commit;
