I thought I'd share with you guys how the SMS database has changed in iPhone OS 3.0. Most of the changes, including the entirely new msg_pieces table, look to be related to MMS messaging capability (that AT&T has yet to unlock), but there are a few other curious additions. I'm not sure why a country field was added to two of the tables. Enjoy!

Database layout in iPhone OS 2.x:

Database layout in OS 2.X

Database layout in iPhone OS 3.0:

Database layout in OS 3.0

Interestingly enough, a shell of the former DB (albeit empty) lives on at /var/mobile/Library/SMS/sms-legacy.db. This is where I was able to see what the prior layout looked like.

I will be doing a follow-up post at some point on a revised cleanup script I'm using on the phone that not only cleans up Nagios text messages, but it also flushes old text messages out of the database on a per-recipient basis; e.g. keep only 500 messages per person. This seems to make the SMS application not drag ass so much when initially loading.