mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 06:46:00 +00:00
handle sparse, zerofill, unsigned, commant flags
This commit is contained in:
@@ -15,7 +15,9 @@ function getColumnInfo({
|
||||
numericScale,
|
||||
defaultValue,
|
||||
columnComment,
|
||||
columnType,
|
||||
}) {
|
||||
const columnTypeTokens = _.isString(columnType) ? columnType.split(' ').map(x => x.trim().toLowerCase()) : [];
|
||||
let fullDataType = dataType;
|
||||
if (charMaxLength && isTypeString(dataType)) fullDataType = `${dataType}(${charMaxLength})`;
|
||||
if (numericPrecision && numericScale && isTypeNumeric(dataType))
|
||||
@@ -27,6 +29,8 @@ function getColumnInfo({
|
||||
columnComment,
|
||||
dataType: fullDataType,
|
||||
defaultValue,
|
||||
isUnsigned: columnTypeTokens.includes('unsigned'),
|
||||
isZerofill: columnTypeTokens.includes('zerofill'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ select
|
||||
NUMERIC_SCALE as numericScale,
|
||||
COLUMN_DEFAULT as defaultValue,
|
||||
COLUMN_COMMENT as columnComment,
|
||||
COLUMN_TYPE as columnType,
|
||||
EXTRA as extra
|
||||
from INFORMATION_SCHEMA.COLUMNS
|
||||
where TABLE_SCHEMA = '#DATABASE#' and TABLE_NAME =OBJECT_ID_CONDITION
|
||||
|
||||
@@ -38,6 +38,22 @@ class Dumper extends SqlDumper {
|
||||
this.endCommand();
|
||||
}
|
||||
|
||||
specialColumnOptions(column) {
|
||||
if (column.isUnsigned) {
|
||||
this.put('^unsigned ');
|
||||
}
|
||||
if (column.isZerofill) {
|
||||
this.put('^zerofill ');
|
||||
}
|
||||
}
|
||||
|
||||
columnDefinition(col, options) {
|
||||
super.columnDefinition(col, options);
|
||||
if (col.columnComment) {
|
||||
this.put(' ^comment %v ', col.columnComment);
|
||||
}
|
||||
}
|
||||
|
||||
renameColumn(column, newcol) {
|
||||
this.changeColumn(
|
||||
column,
|
||||
|
||||
@@ -33,6 +33,8 @@ const dialect = {
|
||||
|
||||
columnProperties: {
|
||||
columnComment: true,
|
||||
isUnsigned: true,
|
||||
isZerofill: true,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user