From 4cbd88b2387f12b9052033fc05445e2c6b54ab96 Mon Sep 17 00:00:00 2001
From: Paul Duncan <pabs@pablotron.org>
Date: Sun, 20 Feb 2022 10:36:52 -0500
Subject: dbstore: add AddCveFeeds(), fix bugs, fix TestAddCveFeed

---
 dbstore/sql/init.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'dbstore/sql/init.sql')

diff --git a/dbstore/sql/init.sql b/dbstore/sql/init.sql
index d38ca37..a54f278 100644
--- a/dbstore/sql/init.sql
+++ b/dbstore/sql/init.sql
@@ -387,7 +387,7 @@ CREATE INDEX in_cves_item_id ON cves(item_id);
 --
 CREATE VIEW cve_nvd_ids AS
   SELECT cve_id,
-         'CVE-' || a.cve_year || '-' || printf('%04d', a.cve_num) AS nvd_cve_id
+         printf('CVE-%04-%04d', cve_year, cve_num) AS nvd_id
     FROM cves;
 
 --
@@ -1225,7 +1225,7 @@ CREATE TRIGGER tr_cve_fts_refresh_after_insert
              h.cve_ref_id, -- cve_ref_id
              j.v2_severity_id, -- v2_severity_id
              l.v3_severity_id, -- v3_severity_id
-             n.nvd_cve_id, -- nvd_cve_id
+             n.nvd_id AS nvd_cve_id, -- nvd_cve_id
              b.assigner, -- assigner
              COALESCE(d.value, ''), -- cve_desc
              COALESCE(g.value, ''), -- pt_desc
@@ -1261,6 +1261,6 @@ CREATE TRIGGER tr_cve_fts_refresh_after_insert
           ON (l.item_id = a.item_id)
         LEFT JOIN severities m
           ON (m.severity_id = l.v3_severity_id)
-        JOIN nvd_cve_ids n
+        JOIN cve_nvd_ids n
           ON (n.cve_id = a.cve_id);
   END;
-- 
cgit v1.2.3

