Reconstructing sms.db
Backstory
This afternoon, I replied to a text from my girlfriend, then apparently neglected to sleep my phone before putting it back in my pocket. When I pulled it back out a few minutes later, my phone had decided to hit "Edit->Clear All" on the conversation, vaporizing two years and two phones worth of SMS history with her. While I have a backup of the phone, it's close to three weeks old at this point, and there's enough solid discussion that I'd like to reconstruct; I've already grabbed a copy of sms.db, but I think the method I used vacuumed the file, so there are no soft-deleted texts in it.
Meat of the Question
I have a three-week old backup of my sms.db
, and have access to date copy of her sms.db
. I'd like to
- export the texts she has but I don't (easy, at least to CSV)
- change the "perspective" info (the
address
field and thesent/received/deleted/unknown
field), keeping the timestamp and text - import/merge these new entries into my old
sms.db
backup - merge this updated backup 开发者_StackOverflowwith my current
sms.db
(optional/there seems to be an online utility for that)
I don't really know SQL but would be willing to learn; the problem I have is that from what I understand, the tables within sms.db
have become more interdependent over the OS's lifespan, and the triggers now call C functions that don't exist outside the phone, so it's not a simple matter of calling a single trigger on multiple entries. Does anyone know of any ways to work around this complexity, or even better, any utilities that have already figured out how to import individual entries into sms.db
?
Edit:
I've been examining sms.db
, and from what I can tell, the relationships are pretty straightforward:
- for
message
, I need to mostly make sure that the ROWID of any added messages are higher than the current highest ROWID msg_group
holds themessage:ROWID
of the last message for each contact; I can lookup the correctaddress
withingroup_member
;group_member:group_id
corresponds withmsg_group:ROWID
msg_group
has a hash column; this will probably be the hardest thing to update, since I'm not immediately sure what it's updating, or what hash to usesqlite_sequence
doesn't seem like it's quite up-to-date; its entries seem to all be smaller than the actual ROWIDs, but I assume this means I won't have to mess with it very much.- I'm not really sure that I'll be able to change
msg_pieces
at all: it's the table in charge of handling the multiple parts of an MMS message.
Hey did you get this sorted out? if you haven't I suggest taking a look at http://smsmerge.homedns.org/
I have been in a similar position as you have, but I was lucky and had a more recent backup than that.
Let me know if you need a hand with it
精彩评论