You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After upgrading to version 8 of the library, a migration pattern created as migrationPattern = path.join(__dirname, 'migrations', '*') does not return any migrations files. Calling postgrator.getMigrations() return an empty array
Expected behavior
The migrations files will be loaded as it happens in versione 7.3
Additional context
I have done some analysis and I think the problem could happen because of these note on the glob project
Note Glob patterns should always use / as a path separator, even on Windows systems, as \ is used to escape glob characters. If you wish to use \ as a path separator instead of using it as an escape character on Windows platforms, you may set windowsPathsNoEscape:true in the options. In this mode, special glob characters cannot be escaped, making it impossible to match a literal * ? and so on in filenames.
I was able to make it works in 2 possible ways:
add a character replace to the migration pattern, ex: migrationPattern = path.join(__dirname, 'migrations', '*').replace(/\\/g,'/')
changing the getMigrations() function of postgrator, setting in the glob call the parameter allowWindowsEscape: false, const migrationFiles = await glob(migrationPattern, {allowWindowsEscape: false});
Both the solution solve the problem, and a filled array is returned when postgrator.getMigrations() is called.
System information
Node v20.18.3
Postgrator 8.0.0
Glob 11.0.0
Microsoft Windows 11 Pro
The text was updated successfully, but these errors were encountered:
Describe the bug
After upgrading to version 8 of the library, a migration pattern created as
migrationPattern = path.join(__dirname, 'migrations', '*')
does not return any migrations files. Callingpostgrator.getMigrations()
return an empty arrayExpected behavior
The migrations files will be loaded as it happens in versione 7.3
Additional context
I have done some analysis and I think the problem could happen because of these note on the glob project
I was able to make it works in 2 possible ways:
migrationPattern = path.join(__dirname, 'migrations', '*').replace(/\\/g,'/')
const migrationFiles = await glob(migrationPattern, {allowWindowsEscape: false});
Both the solution solve the problem, and a filled array is returned when postgrator.getMigrations() is called.
System information
The text was updated successfully, but these errors were encountered: