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

Initiate the db with last synced at? #1842

Open
powderham opened this issue Oct 5, 2024 · 1 comment
Open

Initiate the db with last synced at? #1842

powderham opened this issue Oct 5, 2024 · 1 comment

Comments

@powderham
Copy link
Contributor

I have a case that might be slightly breaking what sync is for, but want to understand if I can do anything here.

I have a language learning app that comes with a set of words in a json in the bundled code. I also want to be able to sync these with a remote server.

Currently the flow is:

Load all the words from the JSON in to the watermelon db on first load
Calls sync for the first time
Receives all of the words from the db, since last synchronized at is undefined

I'd like to be able to set this flag in a robust way if possible.
Are there any problems with setting it directly, or can something else be done?

@powderham
Copy link
Contributor Author

I ended up solving this with the following workflow:

  • Query the db with lastPulledAt = 0/null in the buildstep
  • Store the response as a json
  • Call sync with that JSON on install

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

1 participant