You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The migrate! macro is very handy right now, but it would be nice if it would also handle changes to the migrations - currently, the compiler will just ignore changes to these files when determining whether to use the cached build or not. Emitting const _: &[u8] = include_bytes!(...) for each migration should solve this.
The current behaviour was chosen to be consistent with the query_file! family. Emitting include_*! would also not solve the problem of cached builds with newly created migrations if I'm not mistaken.
Hmm, that is true, and I didn't realize that query_file also worked this way. I still think it would be worth having as an option, maybe as a feature flag.
For now I've just been using a build script that walks the migrations directory and emits cargo:rerun-if-changed=... for each file, which works well enough.
Activity
raftario commentedon Sep 15, 2020
The current behaviour was chosen to be consistent with the
query_file!family. Emittinginclude_*!would also not solve the problem of cached builds with newly created migrations if I'm not mistaken.dmarcuse commentedon Sep 15, 2020
Hmm, that is true, and I didn't realize that
query_filealso worked this way. I still think it would be worth having as an option, maybe as a feature flag.For now I've just been using a build script that walks the
migrationsdirectory and emitscargo:rerun-if-changed=...for each file, which works well enough.abonander commentedon Apr 28, 2021
For modifying existing files, this should have the same solution as here: #663 (comment)
However, picking up new files is another issue entirely, yeah.
abonander commentedon Apr 28, 2021
By the way, you don't need to manually walk the
migrations/directory, it looks likecargo:rerun-if-changed=migrationsshould suffice: https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpathabonander commentedon Jul 14, 2021
A new API in
proc_macrojust recently hit nightly which would fix this:proc_macro::tracked_path::path().fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch
fix(macros): tell the compiler about external files/env vars to watch (…
Merge launchbadge/sqlx master into JetASAP/sqlx master (#12)
Update ws-support (#15)
5 remaining items
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it
build(rust): a Cargo workspace, and the first crate through it (#36)