diff --git a/packages/tools/src/schemaEditorTools.ts b/packages/tools/src/schemaEditorTools.ts index a73a12f7b..c67c3d2d6 100644 --- a/packages/tools/src/schemaEditorTools.ts +++ b/packages/tools/src/schemaEditorTools.ts @@ -9,6 +9,7 @@ import { TableInfo, UniqueInfo, } from 'dbgate-types'; +import _ from 'lodash'; export interface EditorColumnInfo extends ColumnInfo { isPrimaryKey?: boolean; @@ -17,7 +18,7 @@ export interface EditorColumnInfo extends ColumnInfo { export function fillEditorColumnInfo(column: ColumnInfo, table: TableInfo): EditorColumnInfo { return { isPrimaryKey: !!table?.primaryKey?.columns?.find(x => x.columnName == column.columnName), - dataType: column ? undefined : 'int', + dataType: _.isEmpty(column) ? 'int' : undefined, ...column, }; }