Skip to content

Commit f66c012

Browse files
jakubriedljamesgpearce
authored andcommitted
Support postgres schemas
1 parent 4a8237b commit f66c012

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/persisters/common/database/common.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
} from '../../../@types/persisters/index.d.ts';
66
import {arrayJoin, arrayMap} from '../../../common/array.ts';
77
import {IdSet} from '../../../common/set.ts';
8-
import {COMMA, strReplace, TRUE} from '../../../common/strings.ts';
8+
import {COMMA, strReplace, strSplit, TRUE} from '../../../common/strings.ts';
99

1010
export type QuerySchema = (
1111
executeCommand: DatabaseExecuteCommand,
@@ -55,7 +55,11 @@ export const getWrappedCommand = (
5555
}
5656
: executeCommand;
5757

58-
export const escapeId = (str: string) => `"${strReplace(str, /"/g, '""')}"`;
58+
export const escapeId = (str: string) =>
59+
arrayJoin(
60+
arrayMap(strSplit(str, '.'), (part) => `"${strReplace(part, /"/g, '""')}"`),
61+
'.',
62+
);
5963

6064
export const escapeIds = (...ids: Ids) => escapeId(arrayJoin(ids, '_'));
6165

0 commit comments

Comments
 (0)