Tagged: Database

First off some back story for this post. My niece bought a Samsung galaxy S4. She used it for about a month, then decided to go back to her iPhone and give the Samsung to her brother. This meant that as a programmer, I had to find some way to transfer her android messages to her iPhone.

My basic plan is:

  1. backup iPhone via iTunes
  2. backup android SMSs via SMS Backup and Restore
  3. transfer android SMSs into the iPhone backup using sqlite.
  4. restore iPhone from altered backup

So first off I have to take a look at the sms database. It can be found in your iTunes backup folder (for me it was %APPDATA%/Apple Computer/mobile sync/backup/). there’s one more folder with all the backups, the one you are looking for is named “3d0d7e5fb2ce288813306e4d4636395e047a3d28”.

Here are the tables inside:

[Show Tables]

First lets look at how they all relate:

Just from making up this chart of how the tables relate, I have already seen areas where I made mistakes when I first tried to inject messages into the database. If you don’t understand the lines joining each table, here is a quick refernce sheet: http://www.vivekmchawla.com/2013/04/erd-crows-foot-relationship-symbols-quick-reference.html

So a message is made up of: the body of the message (message), an address (handle), a conversation (chat), and sometimes an attachment (attachment).

Lets look at the tables:

[Show Message Table]

[Show Handle Table]

[Show Chat Table]

That’s it for now. I’ll continue this blog post another time, though I hope you have found this helpful so far.

Edit. I spent about 2 hours creating custom shortcodes for wordpress to implement those [Show/Hide] tags. I’ll finish this another day.