Skip to content

Commit 0bcba9b

Browse files
committed
fix(instal): add column to explicit position, sync issues only on version condition
1 parent 1b56e54 commit 0bcba9b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

install/upgrade_to_2.12.5.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ public function addUserRecipient(): void {
4646

4747
// Add users_id_recipient
4848
$table = 'glpi_plugin_formcreator_issues';
49-
$this->migration->addField($table, 'users_id_recipient', 'integer');
49+
if (!$DB->fieldExists($table, 'users_id_recipient')) {
50+
$this->migration->addField($table, 'users_id_recipient', 'integer', ['after' => 'comment']);
5051

51-
// Update issues
52-
$this->migration->migrationOneTable($table);
53-
$DB->query("TRUNCATE `$table`");
54-
PluginFormcreatorIssue::syncIssues();
52+
// Update issues
53+
$this->migration->migrationOneTable($table);
54+
if (PLUGIN_FORMCREATOR_SCHEMA_VERSION == '2.12') {
55+
// sync only if this version is 2.12.5. If the table changes later, this will fail
56+
$DB->query("TRUNCATE `$table`");
57+
PluginFormcreatorIssue::syncIssues();
58+
}
59+
}
5560
}
5661
}

0 commit comments

Comments
 (0)