Skip to content

cargo sqlx prepare picks up queries from another crate #2049

Closed

Description

@djc

When I run cargo sqlx prepare -- --lib inside a crate, it seems to sometimes pick up queries from outside the crate (in another crate, inside the same workspace). This seems to be intermittent -- I see it happening while running prepare in a terminal in a VS Code window, while I also have Rust Analyzer enabled which might be rebuilding other parts of the workspace in the background.

Activity

  1. abonander commented on Aug 16, 2022

    @abonander
    Collaborator

    That's certainly possible. The macros output to the same folder under target/ regardless of source crate and cargo sqlx prepare just bundles up what it finds in there, so if multiple runs are happening at the same time they could be getting mixed together.

  2. djc commented on Aug 16, 2022

    @djc
    ContributorAuthor

    Would you be open to a PR that adds the source crate name to the path, and if so, could you give me some pointers into the source code where this change would need to be made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions