SQLite Sync Across Devices

Does any one have any examples for cloud syncing slqlite databases?

I have an app built with Voltbuilder for iOS and Android, I use SQLite using a cordova plugin. How can I sync the device database across difference devices?

I understand I’d need a cloud server but I have no idea how to set one up or what I need.

The cloud sync function will be an optional function to the app and will need to be an offline first approach. i.e. only update the cloud db when on wifi.

The cloud sync function will enable a user to use the app on different devices i.e. Android phone and iPhone as all data auto syncs.

It’s possible to do (I’ve done a couple of project with this), but I am not of aware of any quick and easy solution.

I understand changing the App can be a lot of work, but this could be a good approach for new Apps. I’ve switched from SQL to NoSQL for a few reasons, but the killer one for me is the replication feature that comes built-in with CouchDB. On the client side I use PouchDB, which implements the CouchDB protocol on top of the known web database standards (it leverages IndexedDB by default, but it can also run on top of SQLite for Cordova apps). Switching your mindset from SQL to NoSQL is tricky at first, but definitely worth afterwards.

I’m not aware of any special recipe for keeping two SQLs in synch, especially if you have SQLite on the app and some other SQL flavor on the backend, besides having a task that compares content from each side and updates accordingly. This can get very complicated fairly easily if there are schema updates, app goes offline, data changes too often… the list can go on and on.

1 Like

Thank you for your feedback.