1

I'm developing an app that stores its data in an sqlite file. Now I'd like to make this app multi-client, so that user can work with the same data on different devices (not simultaneously). I don't have a possibility to raise a dedicated web-service to sync app's data on different devices, so I'm going to use something like Dropbox APIs to sync sqlite files by uploading/downloading changesets.

However, after reading the documentation, I am not sure this will work as I intended. Consider a situation when user adds a record on device A, and this record is automatically assigned an integer primary key (rowid). User then switches to device B and, before syncing, adds a different record which, however, might be assigned the same primary key. Since, as the sqlite documentation goes, changesets work by comparing primary keys, this will lead to a conflict (at best, user will be able to choose which version of the record to accept).

Well, this does not look like data merging. Of course, conflicts can happen if user updates the same record, but if user imports different records which are assigned the same primary key on distinct sqlite files, then, it seems, changesets are not an option.

If this is so and there is no misunderstanding of the sqlite documentation on my part, what is the optimal way to sync app data without developing a specialized web-server? As another option, I consider using unique identifiers for database records, and syncing data (e.g., again via Dropbox APIs) using, say, JSON format.

Maximko
  • 627
  • 8
  • 20
  • I disagree that this is a duplicate. The indicated thread is about general concepts of data synchronization, and my question is not concerned with that at all. My main interest in this question is whether I understand SQLite documentation correctly, as far as applying SQLite changesets is concerned. – Maximko May 20 '18 at 04:24

0 Answers0