From 6d82b044a2d4d75d9e9b4eaa038cac34902a791f Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 21 Oct 2020 18:44:41 +0200 Subject: [PATCH] Add missing result_trash score column --- src/manage_migrators.c | 3 +++ src/manage_pg.c | 1 + src/manage_sql.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/manage_migrators.c b/src/manage_migrators.c index e388d3b15..346f408cd 100644 --- a/src/manage_migrators.c +++ b/src/manage_migrators.c @@ -2484,6 +2484,9 @@ migrate_237_to_238 () sql ("ALTER TABLE results ADD column score integer;"); sql ("UPDATE results SET score = (severity::float * 10)::integer;"); + sql ("ALTER TABLE results_trash ADD column score integer;"); + sql ("UPDATE results_trash SET score = (severity::float * 10)::integer;"); + /* Set the database version to 238. */ set_db_version (238); diff --git a/src/manage_pg.c b/src/manage_pg.c index 119723308..3616a723d 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -2376,6 +2376,7 @@ create_tables () " report integer REFERENCES reports (id) ON DELETE RESTRICT," " nvt_version text," " severity real," + " score integer," " qod integer," " qod_type text," " owner integer REFERENCES users (id) ON DELETE RESTRICT," diff --git a/src/manage_sql.c b/src/manage_sql.c index 80bddd5db..e85047467 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -29454,7 +29454,7 @@ delete_task (task_t task, int ultimate) " report, nvt_version, severity, score, qod, qod_type, owner, date," " hostname, path)" " SELECT uuid, task, host, port, nvt, result_nvt, type," - " description, report, nvt_version, severity, qod," + " description, report, nvt_version, severity, score, qod," " qod_type, owner, date, hostname, path" " FROM results" " WHERE report IN (SELECT id FROM reports WHERE task = %llu);", @@ -46302,7 +46302,7 @@ manage_restore (const char *id) " report, nvt_version, severity, score, qod, qod_type, owner, date," " hostname, path)" " SELECT uuid, task, host, port, nvt, result_nvt, type," - " description, report, nvt_version, severity, qod," + " description, report, nvt_version, severity, score, qod," " qod_type, owner, date, hostname, path" " FROM results_trash" " WHERE report IN (SELECT id FROM reports WHERE task = %llu);",