From d9d4cf259b44aae3c3d6f48ac9e548d92233a813 Mon Sep 17 00:00:00 2001
From: Matthieu Kermagoret <mkermagoret@centreon.com>
Date: Wed, 4 Apr 2018 10:12:33 +0200
Subject: [PATCH] Revert "fix(install): remove unused fields from the
 `instances` table"

This reverts commit 7a92082ce8ba3dcad6ced1bc15228ece67a6d414.
---
 www/install/installBroker.sql                              | 7 ++++++-
 .../sql/centstorage/Update-CSTG-2.8.20_to_2.8.21.sql       | 4 ----
 2 files changed, 6 insertions(+), 5 deletions(-)
 delete mode 100644 www/install/sql/centstorage/Update-CSTG-2.8.20_to_2.8.21.sql

diff --git a/www/install/installBroker.sql b/www/install/installBroker.sql
index b0fe2cd86b..0b16bac4b5 100644
--- a/www/install/installBroker.sql
+++ b/www/install/installBroker.sql
@@ -377,8 +377,10 @@ CREATE TABLE `instances` (
   `name` varchar(255) NOT NULL DEFAULT 'localhost',
   `active_host_checks` tinyint(1) DEFAULT NULL,
   `active_service_checks` tinyint(1) DEFAULT NULL,
+  `address` varchar(128) DEFAULT NULL,
   `check_hosts_freshness` tinyint(1) DEFAULT NULL,
   `check_services_freshness` tinyint(1) DEFAULT NULL,
+  `daemon_mode` tinyint(1) DEFAULT NULL,
   `description` varchar(128) DEFAULT NULL,
   `end_time` int(11) DEFAULT NULL,
   `engine` varchar(64) DEFAULT NULL,
@@ -389,6 +391,7 @@ CREATE TABLE `instances` (
   `global_service_event_handler` text,
   `last_alive` int(11) DEFAULT NULL,
   `last_command_check` int(11) DEFAULT NULL,
+  `last_log_rotation` int(11) DEFAULT NULL,
   `modified_host_attributes` int(11) DEFAULT NULL,
   `modified_service_attributes` int(11) DEFAULT NULL,
   `notifications` tinyint(1) DEFAULT NULL,
@@ -397,10 +400,11 @@ CREATE TABLE `instances` (
   `passive_host_checks` tinyint(1) DEFAULT NULL,
   `passive_service_checks` tinyint(1) DEFAULT NULL,
   `pid` int(11) DEFAULT NULL,
+  `process_perfdata` tinyint(1) DEFAULT NULL,
   `running` tinyint(1) DEFAULT NULL,
   `start_time` int(11) DEFAULT NULL,
   `version` varchar(16) DEFAULT NULL,
-  `deleted` boolean NOT NULL default false,
+  `deleted` boolean NOT NULL default false, 
   `outdated` boolean NOT NULL default false,
   PRIMARY KEY (`instance_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -696,3 +700,4 @@ UNLOCK TABLES;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
diff --git a/www/install/sql/centstorage/Update-CSTG-2.8.20_to_2.8.21.sql b/www/install/sql/centstorage/Update-CSTG-2.8.20_to_2.8.21.sql
deleted file mode 100644
index f67f15ef09..0000000000
--- a/www/install/sql/centstorage/Update-CSTG-2.8.20_to_2.8.21.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-ALTER TABLE `instances` DROP COLUMN `address`;
-ALTER TABLE `instances` DROP COLUMN `daemon_mode`;
-ALTER TABLE `instances` DROP COLUMN `last_log_rotation`;
-ALTER TABLE `instances` DROP COLUMN `process_perfdata`;
-- 
GitLab