Skip to content

Commit c2a3337

Browse files
committed
IColumn type
1 parent 4f47d30 commit c2a3337

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

chat2db-client/src/blocks/DatabaseTableEditor/ColumnList/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
9292
return {
9393
key: uuidv4(),
9494
name: t.name,
95-
length: t.dataType,
95+
columnSize: t.columnSize,
9696
columnType: t.columnType,
97-
nullable: t.nullable === 0,
97+
nullable: t.nullable ? 1 : 0,
9898
comment: t.comment,
9999
}
100100
}) || []
101-
setDataSource(list as any)
101+
setDataSource(list)
102102
}
103103
}, [tableDetails])
104104

@@ -140,14 +140,14 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
140140
}
141141
},
142142
{
143-
title: 'length',
144-
dataIndex: 'length',
143+
title: 'columnSize',
144+
dataIndex: 'columnSize',
145145
editable: true,
146146
render: (text: string, record: IColumnItem) => {
147147
const editable = isEditing(record);
148148
return editable ? (
149149
<Form.Item
150-
name="length"
150+
name="columnSize"
151151
style={{ margin: 0 }}
152152
>
153153
<InputNumber />
@@ -252,9 +252,9 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
252252
const newData = {
253253
key: uuidv4(),
254254
name: '',
255-
length: null,
255+
columnSize: 0,
256256
columnType: null,
257-
nullable: false,
257+
nullable: 0,
258258
}
259259
setDataSource([...dataSource, newData])
260260
edit(newData)

chat2db-client/src/typings/editTable.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ export interface IBaseInfo {
88

99
// 编辑表时列的数据结构
1010
export interface IColumnItem {
11-
key?: string;
11+
key: string;
1212
name: string;
13-
length: number | null;
1413
columnType: string | null;
15-
nullable: boolean;
14+
columnSize: number;
15+
// length: number | null;
16+
nullable: number;
1617
prefixLength?: number | null;
1718
comment?: string;
1819
primaryKey?: boolean;
1920
defaultValue?: string;
20-
dataType: string;
21-
autoIncrement: boolean;
22-
numericPrecision: number;
23-
numericScale: number;
24-
characterMaximumLength: number;
21+
// dataType: string;
22+
// autoIncrement: boolean;
23+
// numericPrecision: number;
24+
// numericScale: number;
25+
// characterMaximumLength: number;
2526
}
2627

2728

0 commit comments

Comments
 (0)