diff --git a/install/upgrade_to_2.13.php b/install/upgrade_to_2.13.php index 7dd13eb4c..043a65332 100644 --- a/install/upgrade_to_2.13.php +++ b/install/upgrade_to_2.13.php @@ -71,7 +71,7 @@ public function fixTables(): void { // with unsigned integer, with assumption that the admin aloready migrated IDs // and FK to unsigned with the GLPI Core CLI command - $unsignedIntType = "INT " . DBConnection::getDefaultPrimaryKeySignOption() . " NOT NULL DEFAULT 0"; + $unsignedIntType = "INT UNSIGNED NOT NULL DEFAULT '0'"; $table = 'glpi_plugin_formcreator_answers'; $this->migration->changeField($table, 'plugin_formcreator_formanswers_id', 'plugin_formcreator_formanswers_id', $unsignedIntType); @@ -98,9 +98,15 @@ public function fixTables(): void { ); $this->migration->changeField($table, 'users_id_validator', 'users_id_validator', $unsignedIntType); $this->migration->changeField($table, 'groups_id_validator', 'groups_id_validator', $unsignedIntType); + $this->migration->changeField($table, 'name', 'name', 'string', ['value' => '']); $this->migration->migrationOneTable($table); $table = 'glpi_plugin_formcreator_questions'; + $DB->update( + $table, + ['name' => ''], + ['name' => null] + ); $this->migration->changeField($table, 'name', 'name', 'string', ['value' => '']); $this->migration->changeField($table, 'description', 'description', 'mediumtext'); // Assume the content of the 2 following columns is out of date @@ -109,7 +115,19 @@ public function fixTables(): void { $this->migration->dropField($table, 'range_max'); $this->migration->migrationOneTable($table); + $table = 'glpi_plugin_formcreator_issues'; + $this->migration->addField($table, 'users_id_validator', 'integer', ['after' => 'requester_id']); + $this->migration->addField($table, 'groups_id_validator', 'integer', ['after' => 'users_id_validator']); + $this->migration->addKey($table, 'users_id_validator', 'users_id_validator'); + $this->migration->addKey($table, 'groups_id_validator', 'groups_id_validator'); + $this->migration->changeField($table, 'itemtype', 'itemtype', 'string', ['value' => '']); + $table = 'glpi_plugin_formcreator_sections'; + $DB->update( + $table, + ['name' => ''], + ['name' => null] + ); $this->migration->changeField($table, 'name', 'name', 'string', ['value' => '']); $this->migration->migrationOneTable($table); @@ -333,6 +351,7 @@ protected function migrateFkToUnsignedInt() { ], 'glpi_plugin_formcreator_issues' => [ 'users_id_recipient', + 'plugin_formcreator_categories_id', ], 'glpi_plugin_formcreator_questions' => [ 'plugin_formcreator_sections_id', @@ -437,6 +456,7 @@ public function fixissues() { $table = 'glpi_plugin_formcreator_issues'; $this->migration->changeField($table, 'name', 'name', 'string', ['after' => 'id', 'nodefault' => true]); + $this->migration->changeField($table, 'status', 'status', 'string', ['value' => '']); } public function isResyncIssuesRequiresd() { diff --git a/install/upgrade_to_2.8.1.php b/install/upgrade_to_2.8.1.php index 00009e7c6..cf6fca18a 100644 --- a/install/upgrade_to_2.8.1.php +++ b/install/upgrade_to_2.8.1.php @@ -33,7 +33,10 @@ class PluginFormcreatorUpgradeTo2_8_1 { * @param Migration $migration */ public function upgrade(Migration $migration) { + global $DB; + $table = 'glpi_plugin_formcreator_issues'; + $DB->query("UPDATE `$table` SET `name`='' WHERE `name` IS NULL"); $migration->changeField($table, 'name', 'name', 'string', ['after' => 'id', 'value' => '']); }