From ca54daf45648e40c878ab2ef180674d4479e9cce Mon Sep 17 00:00:00 2001 From: "Swapnil S. Mahajan" Date: Fri, 25 Mar 2016 16:55:53 +0530 Subject: [PATCH] Added primary key to "software" table "software" is a bridge table so there should always be only one record for a pair of cpeEntryId and cveid. --- .../src/main/resources/data/initialize_mysql.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dependency-check-core/src/main/resources/data/initialize_mysql.sql b/dependency-check-core/src/main/resources/data/initialize_mysql.sql index 49dc8cf27..25bc5bd66 100644 --- a/dependency-check-core/src/main/resources/data/initialize_mysql.sql +++ b/dependency-check-core/src/main/resources/data/initialize_mysql.sql @@ -25,7 +25,8 @@ CREATE TABLE cpeEntry (id INT auto_increment PRIMARY KEY, cpe VARCHAR(250), vend CREATE TABLE software (cveid INT, cpeEntryId INT, previousVersion VARCHAR(50) , CONSTRAINT fkSoftwareCve FOREIGN KEY (cveid) REFERENCES vulnerability(id) ON DELETE CASCADE - , CONSTRAINT fkSoftwareCpeProduct FOREIGN KEY (cpeEntryId) REFERENCES cpeEntry(id)); + , CONSTRAINT fkSoftwareCpeProduct FOREIGN KEY (cpeEntryId) REFERENCES cpeEntry(id) + , PRIMARY KEY (cveid, cpeEntryId)); CREATE INDEX idxVulnerability ON vulnerability(cve); CREATE INDEX idxReference ON reference(cveid); @@ -53,4 +54,4 @@ DELIMITER ; GRANT EXECUTE ON PROCEDURE dependencycheck.save_property TO 'dcuser'; -UPDATE Properties SET value='3.0' WHERE ID='version'; \ No newline at end of file +UPDATE Properties SET value='3.0' WHERE ID='version';