mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 14:03:57 +00:00
analyse computed columns on ms sql #354
This commit is contained in:
@@ -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({
|
function getColumnInfo({
|
||||||
isNullable,
|
isNullable,
|
||||||
isIdentity,
|
isIdentity,
|
||||||
@@ -34,6 +43,7 @@ function getColumnInfo({
|
|||||||
numericScale,
|
numericScale,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
defaultConstraint,
|
defaultConstraint,
|
||||||
|
computedExpression,
|
||||||
}) {
|
}) {
|
||||||
let fullDataType = dataType;
|
let fullDataType = dataType;
|
||||||
if (charMaxLength && isTypeString(dataType)) {
|
if (charMaxLength && isTypeString(dataType)) {
|
||||||
@@ -49,6 +59,7 @@ function getColumnInfo({
|
|||||||
autoIncrement: !!isIdentity,
|
autoIncrement: !!isIdentity,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
defaultConstraint,
|
defaultConstraint,
|
||||||
|
computedExpression: simplifyComutedExpression(computedExpression),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user