From c8405774c0296a453039c2dd588eecee221a514a Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Mon, 3 May 2021 09:07:55 +0200 Subject: [PATCH] fix(install): port DATETIME to TIMESTAMP upgrade bug from glpi Signed-off-by: Thierry Bugier --- install/install.php | 1 + install/upgrade_to_2.11.3.php | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 install/upgrade_to_2.11.3.php diff --git a/install/install.php b/install/install.php index c7e6ee3c1..89bbaab91 100644 --- a/install/install.php +++ b/install/install.php @@ -66,6 +66,7 @@ class PluginFormcreatorInstall { '2.9' => '2.10', '2.10' => '2.10.2', '2.10.2' => '2.11', + '2.11' => '2.11.3', '2.11' => '2.12', ]; diff --git a/install/upgrade_to_2.11.3.php b/install/upgrade_to_2.11.3.php new file mode 100644 index 000000000..1763bad17 --- /dev/null +++ b/install/upgrade_to_2.11.3.php @@ -0,0 +1,51 @@ +. + * --------------------------------------------------------------------- + * @copyright Copyright © 2011 - 2021 Teclib' + * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ + * @link https://github.com/pluginsGLPI/formcreator/ + * @link https://pluginsglpi.github.io/formcreator/ + * @link http://plugins.glpi-project.org/#/plugin/formcreator + * --------------------------------------------------------------------- + */ +class PluginFormcreatorUpgradeTo2_11_3 { + /** @var Migration */ + protected $migration; + + /** + * @param Migration $migration + */ + public function upgrade(Migration $migration) { + global $DB; + + $this->migration = $migration; + + // Convert datetime to timestamp + $table = 'glpi_plugin_formcreator_formanswers'; + $migration->changeField($table, 'request_date', 'request_date', 'datetime'. ' NOT NULL'); + + $table = 'glpi_plugin_formcreator_issues'; + $migration->changeField($table, 'date_creation', 'date_creation', 'datetime'. ' NOT NULL'); + $migration->changeField($table, 'date_mod', 'date_mod', 'datetime'. ' NOT NULL'); + } +}