[4.0.1.45] Hundreds of contacts lost after update

In the 3.x.x database, synchronised constituent contacts had a specific syncTarget field (and most will also have an associated accountId although this is usually stored in out-of-band data rather than easily queryable). In 4.x.x we now support addressbooks as a top-level concept, so each contact is associated with a particular addressbook (collection). See GitHub - sailfishos/qtcontacts-sqlite for details. For the backup/restore code, see nemo-qml-plugin-contacts/tools/vcardconverter/main.cpp at master · sailfishos/nemo-qml-plugin-contacts · GitHub but you’ll have to spelunk through the commit history a bit to see the old syncTarget-based filtering.

The fact that your local contacts were clobbered by the update is very troubling - I’m glad it was resolved via restoring from the backup. I wish I had a copy of a database which failed to migrate properly so that I could investigate further, but I suppose it is too late at this point in any case, as most people will have long since upgraded their device. I can only hope that not too many people hit this same issue, and that all of those who did, had a backup which they could restore their contact data from.