Skip to content

Commit e87b6f5

Browse files
committed
fix(install): preveit failure if tables contains some NULL values
1 parent a94c928 commit e87b6f5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

install/upgrade_to_2.13.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public function upgrade(Migration $migration) {
5454
$this->migrateTablesToDynamic();
5555
}
5656

57+
/**
58+
* Fix possible inconsistencies accumulated over years from 2.5.0 to 2.12.5
59+
*
60+
* @return void
61+
*/
5762
public function fixTables() {
5863
global $DB;
5964
// Based on schema from version 2.12.5, try to fix some harlmess inconsistencies
@@ -68,6 +73,16 @@ public function fixTables() {
6873
$this->migration->migrationOneTable($table);
6974

7075
$table = 'glpi_plugin_formcreator_formanswers';
76+
$DB->update(
77+
$table,
78+
['users_id_validator' => '0'],
79+
['users_id_validator' => null]
80+
);
81+
$DB->update(
82+
$table,
83+
['groups_id_validator' => '0'],
84+
['groups_id_validator' => null]
85+
);
7186
$this->migration->changeField($table, 'users_id_validator', 'users_id_validator', 'integer');
7287
$this->migration->changeField($table, 'groups_id_validator', 'groups_id_validator', 'integer');
7388
$this->migration->migrationOneTable($table);

0 commit comments

Comments
 (0)