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

sqlx mig run ignores symlinks #614

Closed
jplatte opened this issue Aug 6, 2020 · 0 comments · Fixed by #985
Closed

sqlx mig run ignores symlinks #614

jplatte opened this issue Aug 6, 2020 · 0 comments · Fixed by #985

Comments

@jplatte
Copy link
Contributor

jplatte commented Aug 6, 2020

I tried this:

migrations
├ 2020-01-01-121212_init
│ ├ down.sql
│ └ up.sql
├ 2020-02-02-121212_add_stuff
│ ├ down.sql
│ └ up.sql
├ 20200101121212_init.sql -> 2020-01-01-121212_init/up.sql
└ 20200202121212_add_stuff -> 2020-02-02-121212_add_stuff/up.sql

to be able to run up migrations with sqlx now but keep down migrations around for when sqlx supports them.

Unfortunately this doesn't work because the migrator ignores non-regular files.

tgeoghegan added a commit to tgeoghegan/sqlx that referenced this issue Apr 5, 2023
When enumerating the source directory seeking migration files, `sqlx`
ignores entries that aren't files. This was previously reported as launchbadge#614
and fixed in launchbadge#985 but apparently regressed somewhere along the way. This
commit reintroduces the fix from launchbadge#985 to the current implementation: use
`std::fs::metadata` instead of `std::fs::DirEntry::metadata`. The former
is documented to traverse symlinks; the latter does not.
abonander pushed a commit that referenced this issue Jun 13, 2023
* Traverse symlinks when resolving migrations

When enumerating the source directory seeking migration files, `sqlx`
ignores entries that aren't files. This was previously reported as #614
and fixed in #985 but apparently regressed somewhere along the way. This
commit reintroduces the fix from #985 to the current implementation: use
`std::fs::metadata` instead of `std::fs::DirEntry::metadata`. The former
is documented to traverse symlinks; the latter does not.

* add migrations_symlink test
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 a pull request may close this issue.

1 participant