From 79436f3d261206c5b26c2fa56a69305d8eabbe12 Mon Sep 17 00:00:00 2001 From: Griffin Schneider Date: Wed, 25 Dec 2019 19:51:13 -0400 Subject: [PATCH] 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 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7238c57..2d70281 100644 --- a/index.js +++ b/index.js @@ -219,7 +219,7 @@ var PgDriver = Base.extend({ var searchPathes = result[0].search_path.split(','); for (var i = 0; i < searchPathes.length; ++i) { - if (searchPathes[i].indexOf('"') !== 0) { + if (searchPathes[i].indexOf('"') !== -1) { searchPathes[i] = '"' + searchPathes[i].trim() + '"'; } }