--- client-details-fields

create table client_detail_fields (
    id bigint identity(1, 1) primary key,
    client_id bigint not null references clients(id),
    [name] nvarchar(4000) not null,
    name_lower as lower([name]),
    [value] nvarchar(4000) not null,
    deleted bit not null,
    created_at DATETIMEOFFSET NOT NULL,
    updated_at DATETIMEOFFSET NOT NULL
);

create unique index client_detail_fields_client_uniq 
on client_detail_fields(client_id, name_lower);
