Skip to content

Commit 79436f3

Browse files
committedDec 25, 2019
fix(createMigrationsTable): Fix bug where already-quoted search path components could get double-quoted when creating the mirations table.
Postgres's `SHOW search_path` returns the search path as a comma-separated string with spaces, like `"$user", public, "another-quoted-schema"`, so checking whether the _first character_ of a search path component is `"` is not sufficient. Instead, just check whether the search path component contains quotes at all, and don't add any quotes if it does. Signed-off-by: Girffin Schneider <griffinschneider@gmail.com>
1 parent 42e289b commit 79436f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ var PgDriver = Base.extend({
219219
var searchPathes = result[0].search_path.split(',');
220220

221221
for (var i = 0; i < searchPathes.length; ++i) {
222-
if (searchPathes[i].indexOf('"') !== 0) {
222+
if (searchPathes[i].indexOf('"') !== -1) {
223223
searchPathes[i] = '"' + searchPathes[i].trim() + '"';
224224
}
225225
}

0 commit comments

Comments
 (0)
Please sign in to comment.