Skip to content

Commit 7993d30

Browse files
committed
use DEFAULT NULL
1 parent 40a0405 commit 7993d30

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

inc/migration.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function getSQLFields(string $field_name, string $field_type): arr
6767
$fields[$field_name] = 'INT NOT NULL DEFAULT 0';
6868
break;
6969
case $field_type === 'glpi_item':
70-
$fields[sprintf('itemtype_%s', $field_name)] = "varchar(100) NOT NULL DEFAULT ''";
70+
$fields[sprintf('itemtype_%s', $field_name)] = "varchar(100) DEFAULT NULL";
7171
$fields[sprintf('items_id_%s', $field_name)] = "int {$default_key_sign} NOT NULL DEFAULT 0";
7272
break;
7373
case $field_type === 'date':

templates/container.class.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class %%CLASSNAME%% extends CommonDBTM
3333
if ($DB->numrows($result) > 0) {
3434
while ($data = $DB->fetchAssoc($result)) {
3535
//set default value for type 'glpi_item'
36-
if (str_starts_with($data['Field'], 'itemtype_') ) {
37-
$migration->changeField($table, $data['Field'], $data['Field'], "varchar(100) NOT NULL DEFAULT ''");
36+
if (str_starts_with($data['Field'], 'itemtype_')) {
37+
$migration->changeField($table, $data['Field'], $data['Field'], "varchar(100) DEFAULT NULL");
3838
$migration->migrationOneTable(self::getTable());
3939
}
4040
}

0 commit comments

Comments
 (0)