Merging/migrating sms.db from iOS 10 to iOS 12

Preface: simply wiping-restoring a backup from the iOS 10 source device is not a preferred option due to the iOS 12 device being setup differently, and having a very intricately recreated photodata database that would be wiped/replaced with a backup restore.


I have an sms.db dating back to 2012 on an iPhone 5 which was until recently on iOS 6, had a forced upgrade to iOS10, I was surprised to find the sms database stayed intact and accessible by the new OS.

Thought this would make it easier to migrate the database to an iOS 12.1 device, but apparently not.

First I moved the original iOS10 sms.db to the SMS folder - it was marked as incompatible as below:

.incompatible10113 (iOS 10 client version)

string being added to the file extension

That was "fixed" (or I thought so) by editing the ClientVersion string directly in the db properties to 12005 (which is what I got the from the original iOS 12 db). I also moved the Attachments, Drafts and Parts folders to the SMS folder.


The OS now accepts the db (as in, it doesn't get deleted), however doesn't seem to be able to read it/use it.

The main sms.db file stays in place, a sms.db-shm file is created (standard 33kb), but the in-use write-ahead log of the db, sms.db-wal, stays at a low size. It gets written to when a new message is received, and Messages.app displays the new message only. Attempts to search in messages have shown some older entries (potentially cached somewhere other than /Library/SMS), which have since disappeared, and also wiped the newly received messages from view.


Would anyone know whether there is a new schema for sms.db in iOS12, and if so how to make the old db compatible? Alternatively, how would I go about merging those two sqlite databases? Thanks

iPhone X, iOS 12

Posted on May 12, 2019 10:48 AM

Reply
Question marked as Top-ranking reply

Posted on May 19, 2019 1:56 PM

not sure how much of this is accidental, but I managed to restore it:


- copied the full iOS 10 SMS folder (including wal/shm database files)

- pasted into a freshly created SMS folder on iOS 12 - rename the old SMS folder to SMSold or something more creative

- set the permissions on the folder as on the original folder (mobile/mobile owners; 644)

- set the same permissions on the files inside (especially the db files - sms.db and its appendices)

- reboot and hope

somehow, this worked.

iOS seems to have "upgraded" the iOS 10 db itself (ClientVersion property is now 12005), and there are some new tables in the main db file.

Similar questions

5 replies
Question marked as Top-ranking reply

May 19, 2019 1:56 PM in response to tohaklim

not sure how much of this is accidental, but I managed to restore it:


- copied the full iOS 10 SMS folder (including wal/shm database files)

- pasted into a freshly created SMS folder on iOS 12 - rename the old SMS folder to SMSold or something more creative

- set the permissions on the folder as on the original folder (mobile/mobile owners; 644)

- set the same permissions on the files inside (especially the db files - sms.db and its appendices)

- reboot and hope

somehow, this worked.

iOS seems to have "upgraded" the iOS 10 db itself (ClientVersion property is now 12005), and there are some new tables in the main db file.

May 19, 2019 10:32 AM in response to Lawrence Finch

it is accessible via an iTunes backup. Presumably some "forensic" software can also pull this from iCloud if provided credentials.

Understandably, this is not something covered by apple KB articles.

If a user can presumably restore with an <iOS12 backup to an iOS12 device and (presumably) retain messages, why can't this migration be documented/done manually?

Messages.app clearly caches some of the recent messages despite not being able to display my sms.db - when searching from Spotlight I can pull up older messages (1-2 months old), however they disappear if selected in the search results in the Messages.app. I'm guessing it has some cached somewhere, but stumbles when trying to render them in context of sms.db being "unreadable".

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Merging/migrating sms.db from iOS 10 to iOS 12

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.