@@ -66,9 +66,11 @@ public function fixTables(): void {
6666 global $ DB ;
6767 // Based on schema from version 2.12.5, try to fix some harlmess inconsistencies
6868
69+ $ unsignedIntType = "INT " . DBConnection::getDefaultPrimaryKeySignOption () . " NOT NULL DEFAULT 0 " ;
70+
6971 $ table = 'glpi_plugin_formcreator_answers ' ;
70- $ this ->migration ->changeField ($ table , 'plugin_formcreator_formanswers_id ' , 'plugin_formcreator_formanswers_id ' , ' integer ' );
71- $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id ' , 'plugin_formcreator_questions_id ' , ' integer ' );
72+ $ this ->migration ->changeField ($ table , 'plugin_formcreator_formanswers_id ' , 'plugin_formcreator_formanswers_id ' , $ unsignedIntType );
73+ $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id ' , 'plugin_formcreator_questions_id ' , $ unsignedIntType );
7274 $ this ->migration ->migrationOneTable ($ table );
7375
7476 $ table = 'glpi_plugin_formcreator_forms ' ;
@@ -87,8 +89,8 @@ public function fixTables(): void {
8789 ['groups_id_validator ' => '0 ' ],
8890 ['groups_id_validator ' => null ]
8991 );
90- $ this ->migration ->changeField ($ table , 'users_id_validator ' , 'users_id_validator ' , ' integer ' );
91- $ this ->migration ->changeField ($ table , 'groups_id_validator ' , 'groups_id_validator ' , ' integer ' );
92+ $ this ->migration ->changeField ($ table , 'users_id_validator ' , 'users_id_validator ' , $ unsignedIntType );
93+ $ this ->migration ->changeField ($ table , 'groups_id_validator ' , 'groups_id_validator ' , $ unsignedIntType );
9294 $ this ->migration ->migrationOneTable ($ table );
9395
9496 $ table = 'glpi_plugin_formcreator_questions ' ;
@@ -112,33 +114,33 @@ public function fixTables(): void {
112114 );
113115 $ this ->migration ->changeField ($ table , 'validation_followup ' , 'validation_followup ' , 'bool ' , ['after ' => 'urgency_question ' , 'value ' => '1 ' ]);
114116 $ this ->migration ->changeField ($ table , 'destination_entity ' , 'destination_entity ' , 'integer ' , ['after ' => 'validation_followup ' , 'value ' => '1 ' ]);
115- $ this ->migration ->changeField ($ table , 'destination_entity_value ' , 'destination_entity_value ' , ' integer ' , ['after ' => 'destination_entity ' , 'default ' => '1 ' ]);
117+ $ this ->migration ->changeField ($ table , 'destination_entity_value ' , 'destination_entity_value ' , $ unsignedIntType , ['after ' => 'destination_entity ' , 'default ' => '1 ' ]);
116118 $ this ->migration ->changeField ($ table , 'tag_type ' , 'tag_type ' , 'integer ' , ['after ' => 'destination_entity_value ' , 'value ' => '1 ' ]);
117119 $ this ->migration ->changeField ($ table , 'tag_questions ' , 'tag_questions ' , 'string ' , ['after ' => 'tag_type ' ]);
118120 $ this ->migration ->changeField ($ table , 'tag_specifics ' , 'tag_specifics ' , 'string ' , ['after ' => 'tag_questions ' ]);
119121 $ this ->migration ->changeField ($ table , 'category_rule ' , 'category_rule ' , 'integer ' , ['after ' => 'tag_specifics ' , 'value ' => '1 ' ]);
120122 $ this ->migration ->changeField ($ table , 'category_question ' , 'category_question ' , 'integer ' , ['after ' => 'category_rule ' ]);
121123 $ this ->migration ->changeField ($ table , 'associate_rule ' , 'associate_rule ' , 'integer ' , ['after ' => 'category_question ' , 'value ' => '1 ' ]);
122- $ this ->migration ->changeField ($ table , 'associate_question ' , 'associate_question ' , ' integer ' , ['after ' => 'associate_rule ' ]);
124+ $ this ->migration ->changeField ($ table , 'associate_question ' , 'associate_question ' , $ unsignedIntType , ['after ' => 'associate_rule ' ]);
123125 $ this ->migration ->changeField ($ table , 'location_rule ' , 'location_rule ' , 'integer ' , ['after ' => 'associate_question ' , 'value ' => '1 ' ]);
124- $ this ->migration ->changeField ($ table , 'location_question ' , 'location_question ' , ' integer ' , ['after ' => 'location_rule ' ]);
126+ $ this ->migration ->changeField ($ table , 'location_question ' , 'location_question ' , $ unsignedIntType , ['after ' => 'location_rule ' ]);
125127 $ this ->migration ->changeField ($ table , 'show_rule ' , 'show_rule ' , 'integer ' , ['after ' => 'location_question ' , 'value ' => '1 ' ]);
126128 $ this ->migration ->changeField ($ table , 'sla_rule ' , 'sla_rule ' , 'integer ' , ['after ' => 'show_rule ' , 'value ' => '1 ' ]);
127- $ this ->migration ->changeField ($ table , 'sla_question_tto ' , 'sla_question_tto ' , ' integer ' , ['after ' => 'sla_rule ' ]);
128- $ this ->migration ->changeField ($ table , 'sla_question_ttr ' , 'sla_question_ttr ' , ' integer ' , ['after ' => 'sla_question_tto ' ]);
129+ $ this ->migration ->changeField ($ table , 'sla_question_tto ' , 'sla_question_tto ' , $ unsignedIntType , ['after ' => 'sla_rule ' ]);
130+ $ this ->migration ->changeField ($ table , 'sla_question_ttr ' , 'sla_question_ttr ' , $ unsignedIntType , ['after ' => 'sla_question_tto ' ]);
129131 $ this ->migration ->changeField ($ table , 'ola_rule ' , 'ola_rule ' , 'integer ' , ['after ' => 'sla_question_ttr ' , 'value ' => '1 ' ]);
130- $ this ->migration ->changeField ($ table , 'ola_question_tto ' , 'ola_question_tto ' , ' integer ' , ['after ' => 'ola_rule ' ]);
131- $ this ->migration ->changeField ($ table , 'ola_question_ttr ' , 'ola_question_ttr ' , ' integer ' , ['after ' => 'ola_question_tto ' ]);
132+ $ this ->migration ->changeField ($ table , 'ola_question_tto ' , 'ola_question_tto ' , $ unsignedIntType , ['after ' => 'ola_rule ' ]);
133+ $ this ->migration ->changeField ($ table , 'ola_question_ttr ' , 'ola_question_ttr ' , $ unsignedIntType , ['after ' => 'ola_question_tto ' ]);
132134 $ this ->migration ->changeField ($ table , 'uuid ' , 'uuid ' , 'string ' , ['after ' => 'ola_question_ttr ' ]);
133135 $ this ->migration ->migrationOneTable ($ table );
134136
135137 $ table = 'glpi_plugin_formcreator_questiondependencies ' ;
136- $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id ' , 'plugin_formcreator_questions_id ' , ' integer ' );
137- $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id_2 ' , 'plugin_formcreator_questions_id_2 ' , ' integer ' );
138+ $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id ' , 'plugin_formcreator_questions_id ' , $ unsignedIntType );
139+ $ this ->migration ->changeField ($ table , 'plugin_formcreator_questions_id_2 ' , 'plugin_formcreator_questions_id_2 ' , $ unsignedIntType );
138140 $ this ->migration ->migrationOneTable ($ table );
139141
140142 $ table = 'glpi_plugin_formcreator_forms_languages ' ;
141- $ this ->migration ->changeField ($ table , 'plugin_formcreator_forms_id ' , 'plugin_formcreator_forms_id ' , ' integer ' );
143+ $ this ->migration ->changeField ($ table , 'plugin_formcreator_forms_id ' , 'plugin_formcreator_forms_id ' , $ unsignedIntType );
142144 $ this ->migration ->migrationOneTable ($ table );
143145 }
144146
0 commit comments