Make sure we can handle database downgrade (by wiping and starting fresh)

issue 15144138

Change-Id: I59aad7445d2aaaaede1cba6754e047f05a2859ae
This commit is contained in:
Adam Cohen
2014-05-21 19:01:57 -07:00
parent ea90f83e24
commit 9b1d062b0f
@@ -873,6 +873,17 @@ public class LauncherProvider extends ContentProvider {
}
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// This shouldn't happen -- throw our hands up in the air and start over.
Log.w(TAG, "Database version downgrade from: " + oldVersion + " to " + newVersion +
". Wiping databse.");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_WORKSPACE_SCREENS);
onCreate(db);
}
private boolean addProfileColumn(SQLiteDatabase db) {
db.beginTransaction();
try {