Harmonization of tables
Added install and update for DB
This commit is contained in:
@@ -60,13 +60,14 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
$translates = true;
|
||||
// create a reversed map for languages
|
||||
foreach ($CFG_GLPI['languages'] as $key => $valArray) {
|
||||
$mapLangs[ locale_get_primary_language( $key ) ][] = $key;
|
||||
$lg = locale_get_primary_language( $key );
|
||||
$mapLangs[$lg][] = $key;
|
||||
}
|
||||
//}
|
||||
$lang = locale_get_primary_language( $CFG_GLPI['language'] );
|
||||
$query = "SELECT TASK.TAS_UID, TASK.TAS_START, CONTENT.CON_LANG, CONTENT.CON_CATEGORY, CONTENT.CON_VALUE FROM TASK
|
||||
INNER JOIN CONTENT ON CONTENT.CON_ID=TASK.TAS_UID
|
||||
WHERE TASK.TAS_TYPE = 'NORMAL' AND TASK.PRO_UID = '".$this->fields['process_guid']."' AND CONTENT.CON_CATEGORY IN ('TAS_TITLE', 'TAS_DESCRIPTION') ".($translates ? "" : " AND CONTENT.CON_LANG='$lang'")." ;";
|
||||
WHERE (TASK.TAS_TYPE = 'NORMAL' OR TASK.TAS_TYPE = 'SUBPROCESS') AND TASK.PRO_UID = '".$this->fields['process_guid']."' AND CONTENT.CON_CATEGORY IN ('TAS_TITLE', 'TAS_DESCRIPTION') ".($translates ? "" : " AND CONTENT.CON_LANG='$lang'")." ;";
|
||||
$taskArray = [];
|
||||
$defaultLangTaskArray = [];
|
||||
foreach ($PM_DB->request( $query ) as $task) {
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
@@ -71,7 +71,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`domain` varchar(50) DEFAULT '',
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
@@ -87,7 +87,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
@@ -106,7 +106,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
@@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` (
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
@@ -136,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
@@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
@@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
@@ -72,7 +72,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`db_version` varchar(10) NOT NULL DEFAULT '3.2.9',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
@@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
@@ -122,7 +122,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` (
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
@@ -137,7 +137,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
@@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
@@ -160,7 +160,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
@@ -46,6 +46,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
|
||||
`case_num` INT(11) NOT NULL,
|
||||
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
|
||||
`plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL,
|
||||
`is_subprocess` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
INDEX `items` (`itemtype`, `items_id`),
|
||||
INDEX `case_status` (`case_status`),
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -77,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`db_version` varchar(10) NOT NULL DEFAULT '3.3.0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
@@ -93,7 +94,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
@@ -112,7 +113,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
@@ -127,22 +128,23 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_profiles` (
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL,
|
||||
`pm_task_guid` varchar(32) NOT NULL,
|
||||
`taskcategories_id` int(11) NOT NULL,
|
||||
`start` bit(1) NOT NULL DEFAULT b'0',
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_processes_id` INT(11) NOT NULL,
|
||||
`pm_task_guid` VARCHAR(32) NOT NULL,
|
||||
`taskcategories_id` INT(11) NOT NULL,
|
||||
`is_start` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT '1',
|
||||
`is_subprocess` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE INDEX `items` (`taskcategories_id`),
|
||||
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
@@ -152,10 +154,11 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
`itemtype` varchar(32) NOT NULL,
|
||||
`case_id` varchar(32) NOT NULL,
|
||||
`del_index` int(11) NOT NULL,
|
||||
`thread_index` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
@@ -165,7 +168,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
|
||||
@@ -17,23 +17,22 @@ function processmaker_update(){
|
||||
case '2.4.1' :
|
||||
// will upgrade any old versions (< 3.2.8) to 3.2.8
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
|
||||
update_to_3_2_8();
|
||||
$new_version = update_to_3_2_8();
|
||||
|
||||
case '3.2.8' :
|
||||
// will upgrade 3.2.8 to 3.2.9
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_8_to_3_2_9.php");
|
||||
update_3_2_8_to_3_2_9();
|
||||
$new_version = update_3_2_8_to_3_2_9();
|
||||
|
||||
case '3.3.0' :
|
||||
case '3.2.9' :
|
||||
// will upgrade 3.2.9 to 3.3.0
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_9_to_3_3_0.php");
|
||||
update_3_2_9_to_3_3_0();
|
||||
|
||||
$new_version = update_3_2_9_to_3_3_0();
|
||||
}
|
||||
|
||||
// end update by updating the db version number
|
||||
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$current_version' WHERE `id` = 1;";
|
||||
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
|
||||
|
||||
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
function update_3_2_8_to_3_2_9(){
|
||||
global $DB;
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "db_version")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.2.9';
|
||||
|
||||
}
|
||||
|
||||
@@ -7,12 +7,18 @@ function update_3_2_9_to_3_3_0(){
|
||||
// Alter table plugin_processmaker_cases
|
||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ALTER `id` DROP DEFAULT;
|
||||
ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ALTER `id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `id` `case_guid` VARCHAR(32) NOT NULL AFTER `items_id`;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 2" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ADD COLUMN `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket' AFTER `id`,
|
||||
CHANGE COLUMN `id` `case_guid` VARCHAR(32) NOT NULL AFTER `items_id`,
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`,
|
||||
ADD COLUMN `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0' AFTER `plugin_processmaker_processes_id`,
|
||||
DROP INDEX `items`,
|
||||
ADD INDEX `items` (`itemtype`, `items_id`),
|
||||
ADD PRIMARY KEY (`id`),
|
||||
@@ -20,25 +26,31 @@ function update_3_2_9_to_3_3_0(){
|
||||
ADD UNIQUE INDEX `case_num` (`case_num`),
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table" . $DB->error());
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 3" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_profiles")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`;
|
||||
RENAME TABLE `glpi_plugin_processmaker_processes_profiles` TO `glpi_plugin_processmaker_profiles`;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_processes_profiles table" . $DB->error());
|
||||
}
|
||||
$query = "RENAME TABLE `glpi_plugin_processmaker_processes_profiles` TO `glpi_plugin_processmaker_profiles`;";
|
||||
$DB->query($query) or die("error renaming glpi_plugin_processmaker_processes_profiles to glpi_plugin_processmaker_profiles" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_profiles", "plugin_processmaker_processes_id")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_profiles`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`;";
|
||||
$DB->query($query) or die("error renaming processes_id into plugin_processmaker_processes_id" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
ALTER `itemtype` DROP DEFAULT;
|
||||
ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
ALTER `itemtype` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 1" . $DB->error());
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(32) NOT NULL AFTER `id`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NULL AFTER `case_id`,
|
||||
ADD COLUMN `thread_index` INT(11) NOT NULL AFTER `del_index`,
|
||||
DROP INDEX `case_id`,
|
||||
ADD INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`, `del_index`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 2" . $DB->error());
|
||||
|
||||
// transform case_id (=GUID) into plugin_processmaker_cases_id
|
||||
$query = "UPDATE `glpi_plugin_processmaker_tasks`
|
||||
@@ -51,4 +63,19 @@ function update_3_2_9_to_3_3_0(){
|
||||
$DB->query($query) or die("error deleting case_id column in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_taskcategories", "is_subprocess" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
ALTER `processes_id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL AFTER `id`,
|
||||
CHANGE COLUMN `start` `is_start` TINYINT(1) NOT NULL DEFAULT '0' AFTER `taskcategories_id`,
|
||||
ADD COLUMN `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_active`,
|
||||
DROP INDEX `processes_id`,
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 2" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.3.0';
|
||||
}
|
||||
|
||||
@@ -192,5 +192,5 @@ function update_to_3_2_8(){
|
||||
// $DB->query($query) or die("error creating glpi_plugin_processmaker_selfservicedrafts" . $DB->error());
|
||||
//}
|
||||
|
||||
|
||||
return '3.2.8';
|
||||
}
|
||||
Reference in New Issue
Block a user