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

Commit a91150db authored by Unpublished's avatar Unpublished Committed by Niedermann IT-Dienstleistungen
Browse files

Skip dropping automatic indices

They cannot be dropped manually
parent 7d2ac43d
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -27,11 +27,14 @@ public class DatabaseIndexUtil {
    }

    public static void dropIndexes(@NonNull SQLiteDatabase db) {
        Cursor c = db.query("sqlite_master", new String[]{"name"}, "type=?", new String[]{"index"}, null, null, null);
        try (Cursor c = db.query("sqlite_master", new String[]{"name", "sql"}, "type=?", new String[]{"index"}, null, null, null)) {
            while (c.moveToNext()) {
                // Skip automatic indexes which we can't drop manually
                if (c.getString(1) != null) {
                    Log.v(TAG, "Deleting database index: DROP INDEX " + c.getString(0));
                    db.execSQL("DROP INDEX " + c.getString(0));
                }
        c.close();
            }
        }
    }
}