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

I will like to know if watermelonDB is perfect to our NodeJS project #1788

Open
Stancobridge opened this issue May 1, 2024 · 3 comments
Open

Comments

@Stancobridge
Copy link

We have two nodejs backends, one running on the server and another running locally with better-sqlite3.
Our online server already has some data inside it we wish to share with the offline database and initiate a synchronization between them.

Here are our challenges, our database structure has id column in number type, the documentation doesn't really cover how to go about this, so am asking is there a better solution to tackle this without changing our database structure, also is this package the solution our system needs

@primus11
Copy link

primus11 commented May 6, 2024

It is hard to say without bigger picture especially in regard to local server (and what it is even supposed to do) if this is most suited but it is possible.

There is info in regard to id columns here:

@KrisLau
Copy link
Contributor

KrisLau commented Aug 25, 2024

For the id, some of my backend tables have the ID as a numerical number but the sync to the backend is completely controlled by you so you could just parse the int from the string passed by WatermelonDB (similar situation: #1793) or alternatively you could just create a separate id column of a numeric type (something like db_id) and ignore the watermelonDB generated id when querying on the frontend (downside is it would render the watermelon id field a redundant useless field tho).

As for whether it's a good fit for your project I think no one can really answer that other than you but you could probably test using the popular frameworks on a mini copy of your db to see which works best for you and your team. Other option is probably expo's sqlite package.

@rodolforamos
Copy link

For the id, some of my backend tables have the ID as a numerical number but the sync to the backend is completely controlled by you so you could just parse the int from the string passed by WatermelonDB (similar situation: #1793) or alternatively you could just create a separate id column of a numeric type (something like db_id) and ignore the watermelonDB generated id when querying on the frontend (downside is it would render the watermelon id field a redundant useless field tho).

As for whether it's a good fit for your project I think no one can really answer that other than you but you could probably test using the popular frameworks on a mini copy of your db to see which works best for you and your team. Other option is probably expo's sqlite package.

You are a savior!! I searched for days about on how to solve this issue (use server/backend id to sync). The solution is very simple. Parsing the ID as STRING solve the issue.
Thanks.

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

No branches or pull requests

4 participants