From 19f7a5180ca7e045d320177e3089a64b3a83ea59 Mon Sep 17 00:00:00 2001
From: danielmaya <daniel.maya@artica.es>
Date: Tue, 4 Sep 2018 12:48:58 +0200
Subject: [PATCH] Added default value in parent_module_id

---
 pandora_console/extras/mr/20.sql                              | 2 ++
 pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 +-
 pandora_console/pandoradb.sql                                 | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pandora_console/extras/mr/20.sql b/pandora_console/extras/mr/20.sql
index e99b2911d7..3510d7b78f 100644
--- a/pandora_console/extras/mr/20.sql
+++ b/pandora_console/extras/mr/20.sql
@@ -6,4 +6,6 @@ ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
 ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
 ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
 
+ALTER TABLE tagente_modulo ALTER COLUMN `parent_module_id` SET default 0;
+
 COMMIT;
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 7ee1968c4c..88478f5c9b 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -1231,7 +1231,7 @@ ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL defa
 -- ---------------------------------------------------------------------
 ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
 ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
+ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
 ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
 
 -- ---------------------------------------------------------------------
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 6fa0cc6e6e..d7a20a03db 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -259,7 +259,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
 	`prediction_sample_window` int(10) default 0,
 	`prediction_samples` int(4) default 0,
 	`prediction_threshold` int(4) default 0,
-	`parent_module_id` int(10) unsigned NOT NULL,
+	`parent_module_id` int(10) unsigned NOT NULL default 0,
 	`cps` int NOT NULL default 0,
 	PRIMARY KEY  (`id_agente_modulo`),
 	KEY `main_idx` (`id_agente_modulo`,`id_agente`),