mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 04:00:59 +00:00
fixed mssql defaults
This commit is contained in:
parent
7deeb78d69
commit
d661b9f6a4
@ -51,6 +51,15 @@ function getColumnInfo({
|
||||
if (numericPrecision && numericScale && isTypeNumeric(dataType)) {
|
||||
fullDataType = `${dataType}(${numericPrecision},${numericScale})`;
|
||||
}
|
||||
|
||||
if (defaultValue) {
|
||||
defaultValue = defaultValue.trim();
|
||||
while (defaultValue.startsWith('(') && defaultValue.endsWith(')')) {
|
||||
defaultValue = defaultValue.slice(1, -1);
|
||||
defaultValue = defaultValue.trim();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
columnName,
|
||||
dataType: fullDataType,
|
||||
|
@ -128,14 +128,14 @@ class MsSqlDumper extends SqlDumper {
|
||||
if (testEqualColumns(oldcol, newcol, false, false)) {
|
||||
this.dropDefault(oldcol);
|
||||
if (oldcol.columnName != newcol.columnName) this.renameColumn(oldcol, newcol.columnName);
|
||||
this.createDefault(oldcol);
|
||||
this.createDefault(newcol);
|
||||
} else {
|
||||
this.dropDefault(oldcol);
|
||||
if (oldcol.columnName != newcol.columnName) this.renameColumn(oldcol, newcol.columnName);
|
||||
this.put('^alter ^table %f ^alter ^column %i ', oldcol, oldcol.columnName, newcol.columnName);
|
||||
this.columnDefinition(newcol, { includeDefault: false });
|
||||
this.endCommand();
|
||||
this.createDefault(oldcol);
|
||||
this.createDefault(newcol);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user