Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, you've identified the main challenges in your original question. The real answer is that this has little to do with the iPhone - database replication is <em>just really hard</em>.</p> <p>Here are some rules of thumb I can offer:</p> <ul> <li><p><strong>one-way replication</strong> of data is a <em>million times</em> easier than two-way replication, if you can get away with it.</p></li> <li><p>replication is always easier if the database <strong>schema is identical on the client and the server.</strong></p></li> <li><p>to do two-way replication, you either need to store <strong>timestamps for each row on each end,</strong> or to store the complete contents of one end on the other end. (ie. the server needs to know the client's most recent status, or the client needs to know the server's most recent status).</p></li> <li><p>to allow adding rows from disconnected clients, you need to <strong>identify your rows using a GUID</strong> (or hash, eg. SHA-1), not an autoincrement field. It's possible to keep new client-added rows as "identifierless" until you sync them with the server, but that way lies madness.</p></li> <li><p>there is <strong>no actual good way to do conflict resolution.</strong> The imperfect options include last-writer-wins (last person who syncs a modified record gets their copy of the record inserted), three-way-merge (when someone sends a modified record, check which columns they have changed, and change only those columns, thus not overwriting any changes to other columns), split-into-two-records (if two people make changes to the same record, just make two records and assume someone will fix it eventually), and "ask the user" (which is technically the most sound, but requires a lot of UI work and users rarely understand what a conflict even <em>is</em>).</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload