refactor(db): normalize asn prefix cache and ttl cleanup

Строки asn_prefix_cache_row; периодический prune через evobgp-ingest.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-05-25 10:58:57 +07:00
co-authored by Cursor
parent 3500bd4624
commit 990cc739df
9 changed files with 137 additions and 14 deletions
@@ -0,0 +1,10 @@
ALTER TABLE asn_prefix_cache ADD COLUMN prefixes_json JSONB NOT NULL DEFAULT '[]';
UPDATE asn_prefix_cache apc
SET prefixes_json = COALESCE((
SELECT jsonb_agg(apcr.prefix::text ORDER BY apcr.prefix::text)
FROM asn_prefix_cache_row apcr
WHERE apcr.asn = apc.asn
), '[]'::jsonb);
DROP TABLE IF EXISTS asn_prefix_cache_row;