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
I'm not sure if this is something that sqlx is best placed to solve, or whether this is more the domain of cargo, but I noticed that changes to .sql files referenced in query_as_file! aren't picked up in subsequent cargo operations.
This can lead to some subtle bugs where a query did work, but was since changed and not picked up in the next build.
Curious if there's a recommended approach to solving this. Thanks!
We need to emit include_str!() from the macro so the compiler knows to watch the file for changes. The slightly difficult part is that query_file_as!() and include_str!() resolve file paths from different locations, but I think we can just canonicalize the file path and emit it as absolute.
That's normally an anti-pattern as it makes the project not-portable to other machines but since we're canonicalizing on the fly it should be fine.
@Freax13 This seems like a very rare edge case but I think you're right. I'd wouldn't recommend working on that though, I'm currently working on #941 to hopefully get that into 0.5.
Activity
abonander commentedon Aug 30, 2020
We need to emit
include_str!()from the macro so the compiler knows to watch the file for changes. The slightly difficult part is thatquery_file_as!()andinclude_str!()resolve file paths from different locations, but I think we can just canonicalize the file path and emit it as absolute.That's normally an anti-pattern as it makes the project not-portable to other machines but since we're canonicalizing on the fly it should be fine.
Freax13 commentedon Feb 2, 2021
The same should apply to
sqlx-data.json, shouldn't it?jplatte commentedon Feb 2, 2021
@Freax13 This seems like a very rare edge case but I think you're right. I'd wouldn't recommend working on that though, I'm currently working on #941 to hopefully get that into 0.5.
Freax13 commentedon Feb 2, 2021
@jplatte ok, that's great 👍
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)