Skip to content

Commit ba53820

Browse files
committed
corrects table names
1 parent b8b5e90 commit ba53820

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

vulndb/vulndb_service.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (s *VulnDBService) ImportRC(ctx context.Context, opts shared.ImportOptions)
296296
"cves",
297297
"affected_components",
298298
"cve_relationships",
299-
"cve_affected_components",
299+
"cve_affected_component",
300300
"exploits",
301301
"malicious_packages",
302302
"malicious_affected_components",
@@ -422,7 +422,7 @@ func (s *VulnDBService) populateDBFromGobsStream(ctx context.Context, tx pgx.Tx,
422422
exploitChan := make(chan []models.Exploit, 4)
423423
malPkgChan := make(chan malRows, 4)
424424

425-
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_components", "malicious_packages", "malicious_affected_components"}) {
425+
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_component", "malicious_packages", "malicious_affected_components"}) {
426426
if lastImportTime.IsZero() {
427427
slog.Info("starting full import: truncating affected tables before streaming data")
428428
if err := truncateTablesForLimitedImport(ctx, tx, limitedToTables); err != nil {
@@ -431,7 +431,7 @@ func (s *VulnDBService) populateDBFromGobsStream(ctx context.Context, tx pgx.Tx,
431431
}
432432
}
433433

434-
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_components"}) {
434+
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_component"}) {
435435
var existingAffectedComponents map[int64][]int64
436436
if !lastImportTime.IsZero() {
437437
var loadErr error
@@ -525,7 +525,7 @@ func (s *VulnDBService) populateDBFromGobsStream(ctx context.Context, tx pgx.Tx,
525525
}
526526

527527
func truncateTablesForLimitedImport(ctx context.Context, tx pgx.Tx, limitedToTables []string) error {
528-
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_components"}) {
528+
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_component"}) {
529529
if err := truncateCveRelatedTables(ctx, tx); err != nil {
530530
return fmt.Errorf("could not truncate CVE-related tables: %w", err)
531531
}
@@ -551,7 +551,7 @@ func (s *VulnDBService) populateDBFromGobsBulk(ctx context.Context, tx pgx.Tx, w
551551
gobExploit []GobExploit
552552
)
553553

554-
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_components", "malicious_packages", "malicious_affected_components"}) {
554+
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_component", "malicious_packages", "malicious_affected_components"}) {
555555
if lastImportTime.IsZero() {
556556
t := time.Now()
557557
slog.Info("start truncating vulndb tables")
@@ -619,7 +619,7 @@ func (s *VulnDBService) populateDBFromGobsBulk(ctx context.Context, tx pgx.Tx, w
619619

620620
var vulnRows vulndbRows
621621
var malRows malRows
622-
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_components"}) {
622+
if utils.ContainsAny(limitedToTables, []string{"cves", "affected_components", "cve_relationships", "cve_affected_component"}) {
623623
vulnRows = gobOSVToVulnFilterTransformer(lastImportTime, existingAffectedComponents)(osvEntries)
624624
}
625625
if utils.ContainsAny(limitedToTables, []string{"malicious_packages", "malicious_affected_components"}) {
@@ -895,7 +895,7 @@ func streamToDatabase(ctx context.Context, tx pgx.Tx, vulnRowsIn <-chan vulndbRo
895895
"cves", cveCount, "cves_insert_time", cvesTime.Round(time.Millisecond),
896896
"relationships", relationshipCount, "relationships_insert_time", relationshipsTime.Round(time.Millisecond),
897897
"affected_components", affectedComponentCount, "affected_components_insert_time", affectedComponentsTime.Round(time.Millisecond),
898-
"cve_affected_components", cveAffectedComponentCount, "cve_affected_components_insert_time", cveAffectedComponentsTime.Round(time.Millisecond),
898+
"cve_affected_component", cveAffectedComponentCount, "cve_affected_component_insert_time", cveAffectedComponentsTime.Round(time.Millisecond),
899899
"exploits", exploitCount, "exploits_insert_time", exploitsTime.Round(time.Millisecond),
900900
"malicious_packages", malPkgCount, "malicious_packages_insert_time", malPkgTime.Round(time.Millisecond),
901901
"heap_alloc_mb", heapMB(),
@@ -977,7 +977,7 @@ func streamToDatabase(ctx context.Context, tx pgx.Tx, vulnRowsIn <-chan vulndbRo
977977
"cves", cveCount,
978978
"relationships", relationshipCount,
979979
"affected_components", affectedComponentCount,
980-
"cve_affected_components", cveAffectedComponentCount,
980+
"cve_affected_component", cveAffectedComponentCount,
981981
"exploits", exploitCount,
982982
"malicious_packages", malPkgCount,
983983
"took", time.Since(start),

0 commit comments

Comments
 (0)