Fix upgrade problem in I84a2cbe1

I84a2cbe1 didn't upgrade the deleted/updated tables.

Bug 2980891

Change-Id: Ifb0800bab58978352f2239f99186d0503e0dd899
This commit is contained in:
Makoto Onuki 2010-09-07 12:36:48 -07:00
parent fa2386cb11
commit ddc8dea2bd
1 changed files with 14 additions and 1 deletions

View File

@ -91,7 +91,8 @@ public class EmailProvider extends ContentProvider {
// Version 12: Add content_bytes to attachment table. content is deprecated.
// Version 13: Add messageCount to Mailbox table.
// Version 14: Add snippet to Message table
public static final int DATABASE_VERSION = 14;
// Version 15: Fix upgrade problem in version 14.
public static final int DATABASE_VERSION = 15;
// Any changes to the database format *must* include update-in-place code.
// Original version: 2
@ -862,6 +863,18 @@ public class EmailProvider extends ContentProvider {
}
oldVersion = 14;
}
if (oldVersion == 14) {
try {
db.execSQL("alter table " + Message.DELETED_TABLE_NAME
+ " add column " + Message.SNIPPET +" text" + ";");
db.execSQL("alter table " + Message.UPDATED_TABLE_NAME
+ " add column " + Message.SNIPPET +" text" + ";");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 14 to 15 " + e);
}
oldVersion = 15;
}
}
@Override