Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix absolute migration directory support #406

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

amacneil
Copy link
Owner

Closes #403

@amacneil amacneil merged commit 0b6e2ee into main Feb 28, 2023
@amacneil amacneil deleted the adrian/absolutemigrationpath branch February 28, 2023 04:40
@nielslanting
Copy link

nielslanting commented Nov 27, 2023

I think this commit broke Windows paths when working with the Go embed package. I'm trying to use dbmate as a library as specified in https://github.com/amacneil/dbmate#use-dbmate-as-a-library.

readMigrationsDir is called with parameter dir ./db/migrations.
readMigrationsDir uses filepath.Clean.
I assume on Linux machines this will turn it into: db/migrations while on Windows this will get turned into db\\migrations.

https://pkg.go.dev/path/filepath#Clean has different behaviour on Windows.

On Windows, Clean does not modify the volume name other than to replace occurrences of "/" with \. For example, Clean("//host/share/../x") returns \\host\share\x.

db\\migrations is not a valid path for the embedded fs. So it's unable to read the files/dir from the embedded fs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Absolute path for migration directory is no longer working
2 participants