fix(backup): match db.schema.table excludes when database equals schema

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-08-27 22:24:09 +08:00
1 parent ec0b6768be
commit 1016ccc352
2 files changed
+22 -2

No files matched your search

@@ -79,7 +79,7 @@ function tablePatternRegex(pattern: string, caseSensitive: boolean): RegExp {
export function databaseBackupTableMatchesPattern(table: string, patterns: readonly string[], database = "", schema = "", caseSensitive = true): boolean {
const candidates = [table];
if (schema) candidates.push(`${schema}.${table}`);
if (database && schema && database !== schema) candidates.push(`${database}.${schema}.${table}`);
if (database && schema) candidates.push(`${database}.${schema}.${table}`);
return patterns.some((pattern) => {
const matcher = tablePatternRegex(pattern, caseSensitive);
return candidates.some((candidate) => matcher.test(candidate));