Skip to content

Commit

Permalink
fix(install): port DATETIME to TIMESTAMP upgrade bug from glpi
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Jun 13, 2021
1 parent 54cbd0c commit c840577
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand Down
51 changes: 51 additions & 0 deletions install/upgrade_to_2.11.3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* ---------------------------------------------------------------------
* Formcreator is a plugin which allows creation of custom forms of
* easy access.
* ---------------------------------------------------------------------
* LICENSE
*
* This file is part of Formcreator.
*
* Formcreator is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Formcreator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
* @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');
}
}

0 comments on commit c840577

Please sign in to comment.