Skip to content

Commit

Permalink
use DEFAULT NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz committed Jun 8, 2022
1 parent 40a0405 commit 7993d30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inc/migration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function getSQLFields(string $field_name, string $field_type): arr
$fields[$field_name] = 'INT NOT NULL DEFAULT 0';
break;
case $field_type === 'glpi_item':
$fields[sprintf('itemtype_%s', $field_name)] = "varchar(100) NOT NULL DEFAULT ''";
$fields[sprintf('itemtype_%s', $field_name)] = "varchar(100) DEFAULT NULL";
$fields[sprintf('items_id_%s', $field_name)] = "int {$default_key_sign} NOT NULL DEFAULT 0";
break;
case $field_type === 'date':
Expand Down
4 changes: 2 additions & 2 deletions templates/container.class.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class %%CLASSNAME%% extends CommonDBTM
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetchAssoc($result)) {
//set default value for type 'glpi_item'
if (str_starts_with($data['Field'], 'itemtype_') ) {
$migration->changeField($table, $data['Field'], $data['Field'], "varchar(100) NOT NULL DEFAULT ''");
if (str_starts_with($data['Field'], 'itemtype_')) {
$migration->changeField($table, $data['Field'], $data['Field'], "varchar(100) DEFAULT NULL");
$migration->migrationOneTable(self::getTable());
}
}
Expand Down

0 comments on commit 7993d30

Please sign in to comment.