create table application_form ( is_template boolean not null, created_at timestamp(6) not null, modified_at timestamp(6) not null, id uuid not null, created_by_id varchar(255) not null, created_by_name varchar(255) not null, last_modified_by_id varchar(255) not null, last_modified_by_name varchar(255) not null, name varchar(255) not null, organization_id varchar(255), primary key (id) ); create table form_element_options ( employee_data_category tinyint not null check (employee_data_category between 0 and 3), processing_purpose tinyint not null check (processing_purpose between 0 and 3), form_element_id uuid not null, label varchar(255) not null, option_value varchar(255) not null ); create table form_element ( type tinyint not null check (type between 0 and 4), application_form_id uuid not null, id uuid not null, primary key (id) ); alter table if exists form_element_options add constraint FKnq0lpby5nspv1xi27n9el6us6 foreign key (form_element_id) references form_element; alter table if exists form_element add constraint FKdniyq3l10lncw48tft15js5gb foreign key (application_form_id) references application_form;