mssql: fix (varchar(-1) => varchar(max))

This commit is contained in:
Jan Prochazka
2022-04-21 09:48:21 +02:00
parent c3289d09c0
commit 4182132dde

View File

@@ -36,9 +36,12 @@ function getColumnInfo({
defaultConstraint,
}) {
let fullDataType = dataType;
if (charMaxLength && isTypeString(dataType)) fullDataType = `${dataType}(${charMaxLength})`;
if (numericPrecision && numericScale && isTypeNumeric(dataType))
if (charMaxLength && isTypeString(dataType)) {
fullDataType = `${dataType}(${charMaxLength < 0 ? 'MAX' : charMaxLength})`;
}
if (numericPrecision && numericScale && isTypeNumeric(dataType)) {
fullDataType = `${dataType}(${numericPrecision},${numericScale})`;
}
return {
columnName,
dataType: fullDataType,