Skip to content

Issue with embed_migrations! macro resolving relative path during cargo publish #4389

Answered by weiznich
martsokha asked this question in Q&A
Discussion options

You must be logged in to vote

I can reproduce this, but I fear there is not much we as diesel team can do to resolve this. It seem more like an issue with your code structure.

The underlying problem is that if you provide an explicit relative path to the migrations directory like that the proc macro will resolve that directory starting from the crate root. Now cargo publish copies everything (according to the include/exclude rules in your Cargo.toml file) in your crate root (everything in crates/migrate in the case of the migrate crate) into the target/package and tries to build it from there. That then fails as the relative path to the migration directory is now not correct anymore as the migration directory is outside

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@martsokha
Comment options

@weiznich
Comment options

Answer selected by martsokha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants