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

Allow symlinks to be followed for migration files #985

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

djmarcin
Copy link
Contributor

@djmarcin djmarcin commented Jan 15, 2021

entry.metadata() does not follow symlinks, while fs::metadata() does. This allows for greater compatibility with the bazel build system which uses symlinks for data files such as migrations.

Fixes #614

@jplatte
Copy link
Contributor

jplatte commented Jan 15, 2021

You should add

Fixes #614

to the issue description 🙂

@mehcode
Copy link
Member

mehcode commented Jan 21, 2021

Neat. Thanks for the fix.

@mehcode mehcode merged commit 39544b1 into launchbadge:master Jan 21, 2021
@djmarcin djmarcin deleted the allow-symlinks branch January 21, 2021 07:34
tgeoghegan added a commit to tgeoghegan/sqlx that referenced this pull request 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 pull request 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 this pull request may close these issues.

sqlx mig run ignores symlinks
3 participants