formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

rename columns in DB when they don't follow FK naming convention

Open btry opened this issue 3 years ago • 0 comments

When GLPI changes IDs and FK to unsigned numbers, it fails to find many columns because of their non standard name.

We should rename those columns

Le schéma diffère pour la table "glpi_plugin_formcreator_targetchanges".
--- Original
+++ New
@@ @@
 CREATE TABLE `glpi_plugin_formcreator_targetchanges` (
   `id` int NOT NULL AUTO_INCREMENT,
   `backoutplancontent` text,
-  `category_question` int unsigned NOT NULL DEFAULT 0,
+  `category_question` int NOT NULL DEFAULT 0,
   `category_rule` int NOT NULL DEFAULT 1,
   `changetemplates_id` int NOT NULL DEFAULT 0,
   `checklistcontent` text,
@@ @@
   `commonitil_validation_rule` int NOT NULL DEFAULT 1,
   `content` text,
   `controlistcontent` text,
-  `destination_entity_value` int unsigned NOT NULL DEFAULT 0,
+  `destination_entity_value` int NOT NULL DEFAULT 0,
   `destination_entity` int NOT NULL DEFAULT 1,
   `due_date_period` int NOT NULL DEFAULT 0,
-  `due_date_question` int unsigned NOT NULL DEFAULT 0,
+  `due_date_question` int NOT NULL DEFAULT 0,
   `due_date_rule` int NOT NULL DEFAULT 1,
   `due_date_value` tinyint,
   `impactcontent` text,
   `name` varchar(255) NOT NULL DEFAULT '',
-  `ola_question_tto` int unsigned NOT NULL DEFAULT 0,
-  `ola_question_ttr` int unsigned NOT NULL DEFAULT 0,
+  `ola_question_tto` int NOT NULL DEFAULT 0,
+  `ola_question_ttr` int NOT NULL DEFAULT 0,
   `ola_rule` int NOT NULL DEFAULT 1,
   `plugin_formcreator_forms_id` int NOT NULL DEFAULT 0,
   `rolloutplancontent` text,
   `show_rule` int NOT NULL DEFAULT 1,
-  `sla_question_tto` int unsigned NOT NULL DEFAULT 0,
-  `sla_question_ttr` int unsigned NOT NULL DEFAULT 0,
+  `sla_question_tto` int NOT NULL DEFAULT 0,
+  `sla_question_ttr` int NOT NULL DEFAULT 0,
   `sla_rule` int NOT NULL DEFAULT 1,
   `tag_questions` varchar(255) NOT NULL DEFAULT '',
   `tag_specifics` varchar(255) NOT NULL DEFAULT '',
   `tag_type` int NOT NULL DEFAULT 1,
   `target_name` varchar(255) NOT NULL DEFAULT '',
-  `urgency_question` int unsigned NOT NULL DEFAULT 0,
+  `urgency_question` int NOT NULL DEFAULT 0,
   `urgency_rule` int NOT NULL DEFAULT 1,
   `uuid` varchar(255),
   `validation_followup` tinyint NOT NULL DEFAULT 1,
   PRIMARY KEY (`id`)
 )
Le schéma diffère pour la table "glpi_plugin_formcreator_targettickets".
--- Original
+++ New
@@ @@
 CREATE TABLE `glpi_plugin_formcreator_targettickets` (
   `id` int NOT NULL AUTO_INCREMENT,
-  `associate_question` int unsigned NOT NULL DEFAULT 0,
+  `associate_question` int NOT NULL DEFAULT 0,
   `associate_rule` int NOT NULL DEFAULT 1,
-  `category_question` int unsigned NOT NULL DEFAULT 0,
+  `category_question` int NOT NULL DEFAULT 0,
   `category_rule` int NOT NULL DEFAULT 1,
   `commonitil_validation_question` varchar(255),
   `commonitil_validation_rule` int NOT NULL DEFAULT 1,
   `content` text,
-  `destination_entity_value` int unsigned NOT NULL DEFAULT 0,
+  `destination_entity_value` int NOT NULL DEFAULT 0,
   `destination_entity` int NOT NULL DEFAULT 1,
   `due_date_period` int NOT NULL DEFAULT 0,
-  `due_date_question` int unsigned NOT NULL DEFAULT 0,
+  `due_date_question` int NOT NULL DEFAULT 0,
   `due_date_rule` int NOT NULL DEFAULT 1,
   `due_date_value` tinyint,
-  `location_question` int unsigned NOT NULL DEFAULT 0,
+  `location_question` int NOT NULL DEFAULT 0,
   `location_rule` int NOT NULL DEFAULT 1,
   `name` varchar(255) NOT NULL DEFAULT '',
-  `ola_question_tto` int unsigned NOT NULL DEFAULT 0,
-  `ola_question_ttr` int unsigned NOT NULL DEFAULT 0,
+  `ola_question_tto` int NOT NULL DEFAULT 0,
+  `ola_question_ttr` int NOT NULL DEFAULT 0,
   `ola_rule` int NOT NULL DEFAULT 1,
   `plugin_formcreator_forms_id` int NOT NULL DEFAULT 0,
   `show_rule` int NOT NULL DEFAULT 1,
-  `sla_question_tto` int unsigned NOT NULL DEFAULT 0,
-  `sla_question_ttr` int unsigned NOT NULL DEFAULT 0,
+  `sla_question_tto` int NOT NULL DEFAULT 0,
+  `sla_question_ttr` int NOT NULL DEFAULT 0,
   `sla_rule` int NOT NULL DEFAULT 1,
   `source_question` int NOT NULL DEFAULT 0,
   `source_rule` int NOT NULL DEFAULT 0,
@@ @@
   `tag_type` int NOT NULL DEFAULT 1,
   `target_name` varchar(255) NOT NULL DEFAULT '',
   `tickettemplates_id` int NOT NULL DEFAULT 0,
-  `type_question` int unsigned NOT NULL DEFAULT 0,
+  `type_question` int NOT NULL DEFAULT 0,
   `type_rule` int NOT NULL DEFAULT 0,
-  `urgency_question` int unsigned NOT NULL DEFAULT 0,
+  `urgency_question` int NOT NULL DEFAULT 0,
   `urgency_rule` int NOT NULL DEFAULT 1,
   `uuid` varchar(255),
   `validation_followup` tinyint NOT NULL DEFAULT 1,
Le schéma diffère pour la table "glpi_plugin_formcreator_targets_actors".
--- Original
+++ New
@@ @@
   `id` int NOT NULL AUTO_INCREMENT,
   `actor_role` int NOT NULL DEFAULT 1,
   `actor_type` int NOT NULL DEFAULT 1,
-  `actor_value` int unsigned NOT NULL DEFAULT 0,
+  `actor_value` int NOT NULL DEFAULT 0,
   `items_id` int NOT NULL DEFAULT 0,
   `itemtype` varchar(255),
   `use_notification` tinyint NOT NULL DEFAULT 1

btry avatar Jul 18 '22 09:07 btry