Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for mongo? #126

Open
JimLynchCodes opened this issue Aug 30, 2020 · 7 comments
Open

support for mongo? #126

JimLynchCodes opened this issue Aug 30, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@JimLynchCodes
Copy link

Hi, sorry if this already answered here somewhere, but I am curious if support for mongodb and other NoSql databases is on the roadmap or if I should be looking at another tool for doing mongo migrations for my rust micro-services.

Thanks!

@jxs jxs added the enhancement New feature or request label Aug 31, 2020
@jxs
Copy link
Member

jxs commented Aug 31, 2020

Hi, and thanks for your interest.
So when we first created refinery it was for relational databases, therefore the Transaction and Query traits.
That being said, support for NoSql databases such mongodb could be a super interesting addition
Would you be willing to tackle this?

@JimLynchCodes
Copy link
Author

I'm still a noob Rust dev and haven't look into the internals of this package at all so... I'm probably not the right person to do it. 😅

@jxs
Copy link
Member

jxs commented Sep 4, 2020

No worries, If you want to give it a try and have any questions I am on the Rust discord!

@JimLynchCodes
Copy link
Author

Alright, thanks @jxs I'll try to find you on discord. :)

I think the "Query" side could work with Mongo with a very similar API after just changing "table" to "document" or "doc" and allowing Mongo-specific types like ObjectId and IsoDate.

Also, maybe a dumb question, but as a user of this library are you supposed to code out by hand the migration functions (eg. this one)? It is possible somehow to generate the migration implementation from changes to some special struct?

@JimLynchCodes
Copy link
Author

Transactions would be great as well although I think it is still under development for the official mongodb rust driver.

@jxs
Copy link
Member

jxs commented Sep 15, 2020

I think the "Query" side could work with Mongo with a very similar API after just changing "table" to "document" or "doc" and allowing Mongo-specific types like ObjectId and IsoDate.

you need to also implement Transaction as migrate requires T: Transaction, though it doesn't need to be a transaction if the driver doesn't support it.

Also, maybe a dumb question, but as a user of this library are you supposed to code out by hand the migration functions (eg. this one)? It is possible somehow to generate the migration implementation from changes to some special struct?

you can either have migrations from a rust module, or from a .sql file, In Mongo's case it should be a .json

@IgnisDa
Copy link

IgnisDa commented Jan 19, 2023

@jxs Could you please share your discord username? Mine is IgnisDa#5244.

I would like to implement migrations for surrealdb and I think this library could be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants