Rust question: I have a fork of rust-nostr that has a copy of a library that I adapted to a different use case, and I want to have the source within the same project that I'm using it in (adding SQL migrations).

Should I add a new crate to the cargo workspace in the same repository and reference it that way, or should I just put it inside a folder in my existing binary project and use it like that?

Reply to this note

Please Login to reply.

Discussion

You can use ```git submodule```.

It's like a repo in a repo. So when you add your folder, you can keep it separate from the rust project's git repo.

So I still need to maintain the fork, I just add the fork as the submodule right?

I think so, I I understand right. You have a two forked repos, and you can include one in the other as a submodule. The parent repo just requires a single commit any time the submodule changes and is pulled in.

Use the remote git feature of cargo.toml and reference a commit hash of your fork.

That's what I'm doing now. Issue is I have SQL migrations that are project specific and I don't want to pollute my fork. Might just move it to it's own crate.

Migrations could be it's own folder in the repo you created. Then use relative paths for reference? Sounds like it's pretty specific