create schema if not exists kbx;
create table if not exists kbx.sensitive_data_disclosures (
    id bigserial primary key,
    tenant_id uuid not null,
    user_id uuid not null,
    policy_id text not null,
    entity_type text not null,
    entity_id text not null,
    fields jsonb not null,
    reason text null,
    correlation_id text not null,
    occurred_at timestamptz not null default now()
);
create index if not exists ix_sensitive_disclosures_lookup
on kbx.sensitive_data_disclosures(tenant_id, occurred_at desc, policy_id);
