campingmontagut/deploy/booking_guest.sql
jordi fita mas f2b24a83a3 Add check-in form
I based the form from the documentation given by the Mossos
d’Esquadra[0], required by law.

https://registreviatgers.mossos.gencat.cat/mossos_hotels/AppJava/fitxaviatger.do?reqCode=create
2024-04-26 17:09:36 +02:00

36 lines
1.1 KiB
PL/PgSQL

-- Deploy camper:booking_guest to pg
-- requires: roles
-- requires: schema_camper
-- requires: booking
-- requires: sex
-- requires: id_document_type
-- requires: extension_pg_libphonenumber
begin;
set search_path to camper, public;
create table booking_guest (
booking_guest_id integer generated by default as identity primary key,
booking_id integer not null references booking,
id_document_type_id varchar(1) not null references id_document_type,
id_document_number text not null,
id_document_issue_date date,
given_name text not null,
first_surname text not null,
second_surname text not null,
sex_id varchar(1) not null references sex,
birthdate date not null,
country_code country_code not null references country,
phone packed_phone_number,
address text not null,
created_at timestamp with time zone not null default current_timestamp,
updated_at timestamp with time zone not null default current_timestamp,
unique (booking_id, id_document_type_id, id_document_number)
);
grant select, insert, update, delete on table booking_guest to employee;
grant select, insert, update, delete on table booking_guest to admin;
commit;