Skip to content

Commit c08e299

Browse files
authored
fix(install): create tables before filling them (#1234)
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 43cf75c commit c08e299

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

install/upgrade_to_2.7.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ public function upgrade(Migration $migration) {
116116
// Migrate regex question parameters
117117
$table = 'glpi_plugin_formcreator_questions';
118118
if ($DB->fieldExists($table, 'regex')) {
119+
$DB->query(
120+
"CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_questionregexes` (
121+
`id` int(11) NOT NULL AUTO_INCREMENT,
122+
`plugin_formcreator_questions_id` int(11) NOT NULL,
123+
`regex` text DEFAULT NULL,
124+
`fieldname` varchar(255) DEFAULT NULL,
125+
`uuid` varchar(255) DEFAULT NULL,
126+
PRIMARY KEY (`id`),
127+
INDEX `plugin_formcreator_questions_id` (`plugin_formcreator_questions_id`)
128+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
129+
);
119130
$request = [
120131
'FROM' => $table,
121132
'WHERE' => ['fieldtype' => ['float', 'integer', 'text', 'textarea']]
@@ -134,6 +145,18 @@ public function upgrade(Migration $migration) {
134145
// Migrate range question parameters
135146
$table = 'glpi_plugin_formcreator_questions';
136147
if ($DB->fieldExists($table, 'range_min')) {
148+
$DB->query(
149+
"CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_questionranges` (
150+
`id` int(11) NOT NULL AUTO_INCREMENT,
151+
`plugin_formcreator_questions_id` int(11) NOT NULL,
152+
`range_min` varchar(255) DEFAULT NULL,
153+
`range_max` varchar(255) DEFAULT NULL,
154+
`fieldname` varchar(255) DEFAULT NULL,
155+
`uuid` varchar(255) DEFAULT NULL,
156+
PRIMARY KEY (`id`),
157+
INDEX `plugin_formcreator_questions_id` (`plugin_formcreator_questions_id`)
158+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
159+
);
137160
$request = [
138161
'FROM' => $table,
139162
'WHERE' => ['fieldtype' => ['float', 'integer', 'checkboxes', 'multiselect', 'text']]

0 commit comments

Comments
 (0)