So I'm trying to completely clear my tables upon user log out but deleting the tables does not seem to stick and the old data is still there when another user logs in. I'm using RXJava Completables and Room and my code resembles the following.
mDbManager.deleteAllFromTable(mCompositeDisposable)
.doOnComplete(new Action() {
@Override
public void run() {
//Finish logging out.
}
})
.subscribe();
Method in manager looks like
@Override
public Completable deleteAllFromTable(final CompositeDisposable compositeDisposable) {
return Completable.fromAction(new Action() {
@Override
public void run() {
mContactDao.deleteAllFromTable();
vacuumTables(compositeDisposable);
}
}).subscribeOn(mSchedulerProvider.io())
.observeOn(mSchedulerProvider.ui());
}
Method in Dao looks like
@Query("DELETE FROM table")
void deleteAllFromTable();
I've tried it without vacuuming the db and marking the Query as a Transaction and also creating an abstract method for the delete that also vacuums the table and marking that as a Transaction but the data still persists and the deleting is not finished when doOnComplete is called. Another thing I want to point out is that when deleting from the table there are other tables with data linked by foreign keys that are deleted as well.