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

Resolve paths given to embed_migrations as relative to Cargo.toml #471

Merged
merged 1 commit into from
Oct 10, 2016

Conversation

sgrif
Copy link
Member

@sgrif sgrif commented Oct 10, 2016

Macros 1.1 does not give us any way to access the file the macro was
invoked from. In order to make the API compatible with this new system,
we instead resolve paths given as relative to the only stable path we
have access to, which is the location of Cargo.toml. Since it is
somewhat common for people to place their migrations in
src/migrations, we will continue to search that path if no specific
path is given. However, we will no longer find paths such as
src/foo/migrations.

This is based on code from #470, and I've committed as the author of that PR to ensure @weiznich is credited.

@sgrif
Copy link
Member Author

sgrif commented Oct 10, 2016

@killercup Got time for a review?

Macros 1.1 does not give us any way to access the file the macro was
invoked from. In order to make the API compatible with this new system,
we instead resolve paths given as relative to the only stable path we
have access to, which is the location of Cargo.toml. Since it is
somewhat common for people to place their migrations in
`src/migrations`, we will continue to search that path if no specific
path is given. However, we will no longer find paths such as
`src/foo/migrations`.
@sgrif sgrif force-pushed the sg-embed-migrations-relative-to-cargo-toml branch from d504707 to fe01319 Compare October 10, 2016 15:45
Copy link
Member

@killercup killercup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sgrif sgrif merged commit fe01319 into master Oct 10, 2016
@sgrif sgrif deleted the sg-embed-migrations-relative-to-cargo-toml branch October 10, 2016 17:21
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.

3 participants