campingmontagut/deploy/payment_option.sql
jordi fita mas af31daba8a Add positive_integer and nonnegative_integer domains
This is easier to read and requires less unit tests, but i only used
them in the new relations and fields for HEAD, because i do not see any
point on creating migrations just for that.
2024-02-13 22:12:30 +01:00

26 lines
755 B
PL/PgSQL

-- Deploy camper:payment_option to pg
-- requires: roles
-- requires: schema_camper
-- requires: payment
-- requires: campsite_type_option
-- requires: positive_integer
-- requires: nonnegative_integer
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 positive_integer not null,
subtotal nonnegative_integer not null,
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;