Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b1d062b authored by Adam Cohen's avatar Adam Cohen
Browse files

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

issue 15144138

Change-Id: I59aad7445d2aaaaede1cba6754e047f05a2859ae
parent ea90f83e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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 {