camper/deploy/payment_option.sql

24 lines
770 B
PL/PgSQL

-- Deploy camper:payment_option to pg
-- requires: roles
-- requires: schema_camper
-- requires: payment
-- requires: campsite_type_option
begin;
set search_path to camper, public;
create table payment_option (
payment_id integer not null references payment,
campsite_type_option_id integer not null references campsite_type_option,
units integer not null constraint units_positive check (units > 0),
subtotal integer not null constraint subtotal_not_negative check (subtotal >= 0),
primary key (payment_id, campsite_type_option_id)
);
grant select, insert, update, delete on table payment_option to guest;
grant select, insert, update, delete on table payment_option to employee;
grant select, insert, update, delete on table payment_option to admin;
commit;