Should I clear the DBflow instance after removing the database?
Im removing the database in my app, so I can re-init the app. But after deleting, while adding the data im getting duplicate primary keys conflict - its like the data is still there(in cache or something like that)?
This works fine if reopen the app and load the data again, like there is something that resets DBFlow.
Can someone help me how can I propperly clear the data so I can start inserting again - without closing my app first?
Here is what im doing while deleting the DB:
getDatabasePath(BetterBillDatabase.NAME).delete();
FlowManager.getDatabase(BetterBillDatabase.NAME).reset(this);
FlowManager.init(this);
I had the same issue and I ended up deleting table by table:
private void deleteAllTables() {
deleteAllLogTables();
deleteAllDownloadedTables();
}
private void deleteAllDownloadedTables() {
Delete.tables(tableListExtendingFromModel);
}
private void deleteAllLogTables() {
Delete.tables(AccreditationLog.class, AdmissionLog.class);
}
Not the elegant way but works whithout applying reflection: https://github.com/Raizlabs/DBFlow/pull/253
I'm facing this issue right now. Is there a proper fix / work-around for this ?
Thanks!
Same problem here. @agrosner Have you any idea?
Since I opened this issue, I fogot to say that I found the answer few days ago. The answer is this:
// Delete a whole table Delete.table(MyTable.class, conditions); // Delete multiple instantly Delete.tables(MyTable1.class, MyTable2.class);
You can see more here: https://github.com/Raizlabs/DBFlow/blob/master/usage/SQLQuery.md
I've been using that reflection hack in production for months now, no issues. This is still an issue DBFlow should be solving though, not its users.
On Sun, Oct 4, 2015, 8:26 AM khafan [email protected] wrote:
Same problem here. @agrosner https://github.com/agrosner Have you any idea?
— Reply to this email directly or view it on GitHub https://github.com/Raizlabs/DBFlow/issues/390#issuecomment-145344278.