--- client-details-fields

create table client_detail_fields (
    id bigint primary key,
    client_id bigint not null references clients(id),
    name varchar(4000) not null,
    value varchar(4000) not null,
    deleted boolean not null,
    created_at timestamptz not null,
    updated_at timestamptz not null
);

create sequence client_detail_fields_id_seq;

create unique index client_detail_fields_uniq
on client_detail_fields(client_id, lower(name));
