diff --git a/lib/postgrator-cli.js b/lib/postgrator-cli.js index 6f41a90..9c92665 100644 --- a/lib/postgrator-cli.js +++ b/lib/postgrator-cli.js @@ -23,9 +23,16 @@ function getMigrateToNumber(toArgument) { } function getAbsolutePath(fileOrDirectory) { - return (path.isAbsolute(fileOrDirectory)) + const absPath = (path.isAbsolute(fileOrDirectory)) ? fileOrDirectory : path.join(process.cwd(), fileOrDirectory); + + // Paths must use posix forward slashes to work properly ever since + // postgrator updated to the newer version of glob + // + // https://github.com/rickbergfalk/postgrator/blob/master/CHANGELOG.md#800 + // https://github.com/isaacs/node-glob/blob/main/changelog.md#81 + return absPath.replaceAll(path.sep, path.posix.sep); } const loadYaml = (_, content) => yaml.parse(content);