优化代码

This commit is contained in:
2020-05-09 17:52:57 +08:00
parent ad7993478a
commit ed35d06208
6 changed files with 64 additions and 47 deletions

View File

@@ -114,8 +114,8 @@ class Datatable {
} else {
$field_attr['length'] = "";
}
$field_attr['is_null'] = $attr['is_must'] ? 'NOT NULL' : 'NULL';
$field_attr['default'] = $attr['value'] != '' ? 'DEFAULT "' . $attr['value'] . '"' : '';
$field_attr['is_null'] = (isset($attr['is_must']) && $attr['is_must']) ? 'NOT NULL' : 'NULL';
$field_attr['default'] = (isset($attr['is_must']) && $attr['is_must'] !== '') ? 'DEFAULT "' . $attr['value'] . '"' : '';
$field_attr['comment'] = (isset($attr['remark']) && $attr['remark']) ? $attr['remark'] : $attr['title'];
$field_attr['after'] = (isset($attr['after']) && $attr['after']) ? ' AFTER `' . $attr['after'] . '`' : ' AFTER `id`';