For example, android platform has something like:
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
db.execSQL("DROP TABLE ....");
db.execSQL("ATER TABLE ....");
onCreate(db);
}
Which is very good to handle upgrades, etc.
Is there a similar strategy for .deb packages? I know I can use the debian/control, debian/preinst to get current version, debian/postinst to handle then the database upgrade, but it's not as neat of a solution.
Nope, there isn't. It doesn't need to be much less clean, though. Your postinst just needs to have something like
case "$1" in
configure)
oldver=$2
if dpkg --compare-versions "$oldver" -lt 1.2.3; then
sqlite3 mydb.db 'DROP TABLE W...'
sqlite3 mydb.db 'ALTER TABLE X...'
fi
if dpkg --compare-versions "$oldver" -lt 1.3.4; then
sqlite3 mydb.db 'DROP TABLE Y...'
sqlite3 mydb.db 'ALTER TABLE Z...'
fi
;;
...
esac