Open Stancobridge opened 6 months ago
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:
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: https://github.com/Nozbe/WatermelonDB/issues/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.
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.
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