Skip to content

Commit c840577

Browse files
committed
fix(install): port DATETIME to TIMESTAMP upgrade bug from glpi
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 54cbd0c commit c840577

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

install/install.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PluginFormcreatorInstall {
6666
'2.9' => '2.10',
6767
'2.10' => '2.10.2',
6868
'2.10.2' => '2.11',
69+
'2.11' => '2.11.3',
6970
'2.11' => '2.12',
7071
];
7172

install/upgrade_to_2.11.3.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* ---------------------------------------------------------------------
4+
* Formcreator is a plugin which allows creation of custom forms of
5+
* easy access.
6+
* ---------------------------------------------------------------------
7+
* LICENSE
8+
*
9+
* This file is part of Formcreator.
10+
*
11+
* Formcreator is free software; you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation; either version 2 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* Formcreator is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
23+
* ---------------------------------------------------------------------
24+
* @copyright Copyright © 2011 - 2021 Teclib'
25+
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+
26+
* @link https://github.com/pluginsGLPI/formcreator/
27+
* @link https://pluginsglpi.github.io/formcreator/
28+
* @link http://plugins.glpi-project.org/#/plugin/formcreator
29+
* ---------------------------------------------------------------------
30+
*/
31+
class PluginFormcreatorUpgradeTo2_11_3 {
32+
/** @var Migration */
33+
protected $migration;
34+
35+
/**
36+
* @param Migration $migration
37+
*/
38+
public function upgrade(Migration $migration) {
39+
global $DB;
40+
41+
$this->migration = $migration;
42+
43+
// Convert datetime to timestamp
44+
$table = 'glpi_plugin_formcreator_formanswers';
45+
$migration->changeField($table, 'request_date', 'request_date', 'datetime'. ' NOT NULL');
46+
47+
$table = 'glpi_plugin_formcreator_issues';
48+
$migration->changeField($table, 'date_creation', 'date_creation', 'datetime'. ' NOT NULL');
49+
$migration->changeField($table, 'date_mod', 'date_mod', 'datetime'. ' NOT NULL');
50+
}
51+
}

0 commit comments

Comments
 (0)