From 9b8188828cdbcdfe20ad216c93c7da3ffaeb140f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Membr=C3=A9?= Date: Tue, 10 Jan 2017 17:04:11 +0100 Subject: [PATCH] Fixes #9943: Migration script to add compliance table --- ...gration-4.0.x-4.1-add-compliance-table.sql | 60 +++++++++++++++++++ .../src/main/resources/reportsSchema.sql | 6 +- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 rudder-core/src/main/resources/Migration/dbMigration-4.0.x-4.1-add-compliance-table.sql diff --git a/rudder-core/src/main/resources/Migration/dbMigration-4.0.x-4.1-add-compliance-table.sql b/rudder-core/src/main/resources/Migration/dbMigration-4.0.x-4.1-add-compliance-table.sql new file mode 100644 index 0000000000..94d72075a4 --- /dev/null +++ b/rudder-core/src/main/resources/Migration/dbMigration-4.0.x-4.1-add-compliance-table.sql @@ -0,0 +1,60 @@ +/* +************************************************************************************* +* Copyright 2017 Normation SAS +************************************************************************************* +* +* This file is part of Rudder. +* +* Rudder is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* In accordance with the terms of section 7 (7. Additional Terms.) of +* the GNU General Public License version 3, the copyright holders add +* the following Additional permissions: +* Notwithstanding to the terms of section 5 (5. Conveying Modified Source +* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU General +* Public License version 3, when you create a Related Module, this +* Related Module is not considered as a part of the work and may be +* distributed under the license agreement of your choice. +* A "Related Module" means a set of sources files including their +* documentation that, without modification of the Source Code, enables +* supplementary functions or services in addition to those offered by +* the Software. +* +* Rudder is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Rudder. If not, see . + +* +************************************************************************************* +*/ + +CREATE TABLE nodeCompliance ( + nodeId text NOT NULL CHECK (nodeId <> '') +, runTimestamp timestamp with time zone NOT NULL +, endOfLife timestamp with time zone +, runAnalysis text NOT NULL CHECK (runAnalysis <> '' ) +, summary text NOT NULL CHECK (summary <> '' ) +, details text NOT NULL CHECK (details <> '' ) +, PRIMARY KEY (nodeId, runTimestamp) +); + +CREATE INDEX nodeCompliance_nodeId ON nodeCompliance (nodeId); +CREATE INDEX nodeCompliance_runTimestamp ON nodeCompliance (runTimestamp); +CREATE INDEX nodeCompliance_endOfLife ON nodeCompliance (endOfLife); + +CREATE TABLE archivedNodeCompliance ( + nodeId text NOT NULL CHECK (nodeId <> '') +, runTimestamp timestamp with time zone NOT NULL +, endOfLife timestamp with time zone +, runAnalysis text NOT NULL CHECK (runAnalysis <> '' ) +, summary text NOT NULL CHECK (summary <> '' ) +, details text NOT NULL CHECK (details <> '' ) +, PRIMARY KEY (nodeId, runTimestamp) +); diff --git a/rudder-core/src/main/resources/reportsSchema.sql b/rudder-core/src/main/resources/reportsSchema.sql index c25432e55a..0306a57c2b 100644 --- a/rudder-core/src/main/resources/reportsSchema.sql +++ b/rudder-core/src/main/resources/reportsSchema.sql @@ -242,9 +242,9 @@ CREATE TABLE nodeCompliance ( , PRIMARY KEY (nodeId, runTimestamp) ); -CREATE INDEX nodeCompliance_nodeId ON nodeCoCompliance (nodeId); -CREATE INDEX nodeCompliance_runTimestamp ON nodeCoCompliance (runTimestamp); -CREATE INDEX nodeCompliance_endOfLife ON nodeCoCompliance (endOfLife); +CREATE INDEX nodeCompliance_nodeId ON nodeCompliance (nodeId); +CREATE INDEX nodeCompliance_runTimestamp ON nodeCompliance (runTimestamp); +CREATE INDEX nodeCompliance_endOfLife ON nodeCompliance (endOfLife); -- Create the table for the archived node compliance CREATE TABLE archivedNodeCompliance (