fix(kingbase): preserve SQLServer identity metadata

This commit is contained in:
t8y2 committed 2026-07-15 13:01:18 +08:00
1 parent 002dbbf602
commit 904863a57c
6 files changed
+192 -2

No files matched your search

@@ -477,6 +477,16 @@ export function parseExtraToColumnExtra(extra: string | null | undefined, databa
result.identity.seed = Number(sequenceMatch[1]);
result.identity.increment = Number(sequenceMatch[2]);
}
} else if (databaseType === "kingbase") {
// SQLServer compatibility reports IDENTITY(seed, increment) instead of PostgreSQL identity syntax.
const sqlServerIdentityMatch = lower.match(/identity\s*\(\s*(-?\d+)\s*,\s*(-?\d+)\s*\)/i);
if (sqlServerIdentityMatch) {
result.autoIncrement = true;
result.identity = {
seed: Number(sqlServerIdentityMatch[1]),
increment: Number(sqlServerIdentityMatch[2]),
};
}
}
} else if (databaseType === "sqlserver") {
if (lower.includes("identity")) {