mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
analyse computed columns on ms sql #354
This commit is contained in:
parent
8acafbbd6e
commit
fdecef7e78
@ -24,6 +24,15 @@ function objectTypeToField(type) {
|
||||
}
|
||||
}
|
||||
|
||||
function simplifyComutedExpression(expr) {
|
||||
if (expr) {
|
||||
while (expr.startsWith('(') && expr.endsWith(')')) {
|
||||
expr = expr.slice(1, -1);
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
function getColumnInfo({
|
||||
isNullable,
|
||||
isIdentity,
|
||||
@ -34,6 +43,7 @@ function getColumnInfo({
|
||||
numericScale,
|
||||
defaultValue,
|
||||
defaultConstraint,
|
||||
computedExpression,
|
||||
}) {
|
||||
let fullDataType = dataType;
|
||||
if (charMaxLength && isTypeString(dataType)) {
|
||||
@ -49,6 +59,7 @@ function getColumnInfo({
|
||||
autoIncrement: !!isIdentity,
|
||||
defaultValue,
|
||||
defaultConstraint,
|
||||
computedExpression: simplifyComutedExpression(computedExpression),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user