From ddc8dea2bdfb85838f70dc1c2f173e42b86c7554 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 7 Sep 2010 12:36:48 -0700 Subject: [PATCH] Fix upgrade problem in I84a2cbe1 I84a2cbe1 didn't upgrade the deleted/updated tables. Bug 2980891 Change-Id: Ifb0800bab58978352f2239f99186d0503e0dd899 --- src/com/android/email/provider/EmailProvider.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 68516eb08..5e3ce6fc2 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -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