Major schema refactoring: simplify ASN and prefix tracking

- Remove UUID primary keys from ASNs table, use ASN number as primary key
- Update announcements table to reference ASN numbers directly
- Rename asns.number column to asns.asn for consistency
- Add prefix tracking to PrefixHandler to populate prefixes_v4/v6 tables
- Add UpdatePrefixesBatch method for efficient batch updates
- Update all database methods and models to use new schema
- Fix all references in code to use ASN field instead of Number
- Update test mocks to match new interfaces
This commit is contained in:
2025-07-28 22:58:55 +02:00
parent a165ecf759
commit c9da20e630
8 changed files with 201 additions and 53 deletions

View File

@@ -605,7 +605,7 @@ func (s *Server) handlePrefixDetail() http.HandlerFunc {
// Group by origin AS and collect unique AS info
type ASNInfo struct {
Number int
ASN int
Handle string
Description string
PeerCount int
@@ -622,7 +622,7 @@ func (s *Server) handlePrefixDetail() http.HandlerFunc {
description = asInfo.Description
}
originMap[route.OriginASN] = &ASNInfo{
Number: route.OriginASN,
ASN: route.OriginASN,
Handle: handle,
Description: description,
PeerCount: 0,
@@ -655,7 +655,7 @@ func (s *Server) handlePrefixDetail() http.HandlerFunc {
// Create enhanced routes with AS path handles
type ASPathEntry struct {
Number int
ASN int
Handle string
}
type EnhancedRoute struct {
@@ -674,7 +674,7 @@ func (s *Server) handlePrefixDetail() http.HandlerFunc {
for j, asn := range route.ASPath {
handle := asinfo.GetHandle(asn)
enhancedRoute.ASPathWithHandle[j] = ASPathEntry{
Number: asn,
ASN: asn,
Handle: handle,
}
}