Skip to content

Commit

Permalink
Fix #130 : Add table creation SQL code for questions matching with a …
Browse files Browse the repository at this point in the history
…GLPI object
  • Loading branch information
neeftarah committed Oct 27, 2015
1 parent 728b65b commit 9816825
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,22 @@ public static function install(Migration $migration)
DROP `plugin_formcreator_forms_id`;";
$GLOBALS['DB']->query($query) or die ($GLOBALS['DB']->error());
}

if (!TableExists('glpi_plugin_formcreator_matching_questions')) {
$migration->displayMessage("Installing glpi_plugin_formcreator_matching_questions");

// Create questions table
$query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_matching_questions` (
`questions_id` int(11) NOT NULL,
`targets_id` int(11) NOT NULL,
`fields` int(11) NOT NULL,
CONSTRAINT pk_questions_targets PRIMARY KEY (questions_id, targets_id)
)
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci";
$GLOBALS['DB']->query($query) or die ($GLOBALS['DB']->error());
}

return true;
}
Expand All @@ -805,6 +821,10 @@ public static function uninstall()
$obj = new self();
$GLOBALS['DB']->query('DROP TABLE IF EXISTS `' . $obj->getTable() . '`');

if (!TableExists('glpi_plugin_formcreator_matching_questions')) {
$GLOBALS['DB']->query('DROP TABLE IF EXISTS `glpi_plugin_formcreator_matching_questions`');
}

// Delete logs of the plugin
$GLOBALS['DB']->query('DELETE FROM `glpi_logs` WHERE itemtype = "' . __CLASS__ . '"');

Expand Down

0 comments on commit 9816825

Please sign in to comment.