wordpress-mobile/WordPress-Android — pull request #1599 by maxme (2014-07-08 13:13:19+00:00)
Title: fix #1591: fix db initialization by forcing DB deletion in case current DB is invalid

It's tricky to test this, one method:

1. Apply this patch
```
--- a/src/org/wordpress/android/WordPressDB.java
+++ b/src/org/wordpress/android/WordPressDB.java
@@ -163,6 +163,7 @@ public class WordPressDB {
case 0:
// New install
currentVersion++;
+ db.execSQL(ADD_BLOGID);
case 1:
// Add columns that were added in very early releases, then move on to version 9
db.execSQL(ADD_BLOGID);
@@ -245,14 +246,14 @@ public class WordPressDB {
db.execSQL("DROP TABLE IF EXISTS notes;");
currentVersion++;
}
- db.setVersion(DATABASE_VERSION);
+ db.setVersion(0);
}
```
2. Delete the app
3. Install and run the app with previous patch (it's going to crash on startup)
4. Reverse previous patch
5. Install `issue/1591-wpdb-init-exception` version on top of current app -> that should work even if following case is going to be executed
```
case 1:
// Add columns that were added in very early releases, then move on to version 9
db.execSQL(ADD_BLOGID);
```