Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
fix(update): fix install script for a DB schema update
Browse files Browse the repository at this point in the history
Signed-off-by: Domingo Oropeza <doropeza@teclib.com>
  • Loading branch information
DIOHz0r authored and btry committed May 4, 2018
1 parent f32b782 commit 05e462e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions install/upgrade/update_to_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ function plugin_flyvemdm_update_to_dev(Migration $migration) {

// Upgrade schema to apply policies on agents
$table = 'glpi_plugin_flyvemdm_tasks';
$migration->changeField($table, 'plugin_flyvemdm_fleets_id', 'items_id_applied', 'integer');
$migration->addField($table, 'itemtype_applied', 'string', ['after' => 'id']);
// All tasks already created were applied on fleets
$migration->addPostQuery("UPDATE `$table` SET `itemtype_applied` = 'PluginFlyvemdmFleet'");
if (!$DB->fieldExists($table, 'items_id_applied')) {
$migration->changeField($table, 'plugin_flyvemdm_fleets_id', 'items_id_applied', 'integer');
$migration->addField($table, 'itemtype_applied', 'string', ['after' => 'id']);
// All tasks already created were applied on fleets
$migration->addPostQuery("UPDATE `$table` SET `itemtype_applied` = 'PluginFlyvemdmFleet'");
$migration->executeMigration();
}

$table = 'glpi_plugin_flyvemdm_policies';
$policies = [
Expand Down

0 comments on commit 05e462e

Please sign in to comment.