Untitled

 avatar
unknown
plain_text
a year ago
1.4 kB
6
Indexable
create table insurance_type
(
    insurance_type_code marketing.insurance_type_code not null
        primary key
);

create table insurance_end_info
(
    insurance_end_info_id integer generated always as identity
        primary key,
    cif                   marketing.cif            default marketing.current_cif()            not null,
    channel_id            varchar(16)              default marketing.current_channel_id()     not null,
    case_applicant        varchar(16)              default marketing.current_case_applicant() not null,
    branch_code           varchar(16)              default marketing.current_unit_id(),
    insurance_type_code   marketing.insurance_type_code                                       not null
        references insurance_type,
    insurance_end_date    date                                                                not null,
    external_id           varchar(64)              default marketing.external_id()            not null,
    created_date          timestamp with time zone default now()                              not null,
    sent_to_crm_date      timestamp with time zone,
    sent_to_khd_date      timestamp with time zone,
    constraint insurance_end_info_unique_creation
        unique (cif, created_date),
    constraint insurance_end_info_end_date_not_in_the_past_check
        check (insurance_end_date >= date(created_date))
);


Editor is loading...
Leave a Comment