create table asset_ip_history
(
    id         bigint generated by default as identity primary key,
    asset_id   bigint      not null references hosts (id) on update cascade on delete cascade,
    ip         inet        not null,
    first_seen timestamptz not null default now(),
    last_seen  timestamptz not null default now(),
    unique (asset_id, ip)
);

create index asset_ip_history_asset_id_idx on asset_ip_history (asset_id);
create index asset_ip_history_ip_idx on asset_ip_history (ip);
