pilgr / Paper

Paper is a fast NoSQL-like storage for Java/Kotlin objects on Android with automatic schema migration support.
Apache License 2.0
2.34k stars 234 forks source link

Method to delete all data #164

Closed RingoMckraken closed 4 years ago

RingoMckraken commented 4 years ago

Given a situation where an app uses the global Paper.book() as well as some named ones, is there a way built into paper that can delete all books in one call? My situation is I've been handed a code base where the previous developer has left but there does not seem to be anyway of tracking down the different versions and keys they used to for different versions of the app.

pilgr commented 4 years ago

No, Paper doesn't have the function for that. The only way to remove the old data without knowing the names for the "books" is to remove all folders in app's internal storage which has files with *.pt extension. But as I said, Paper DB doesn't have the built-in function for that.

RingoMckraken commented 4 years ago

Thanks for the response, I have found a (somewhat hacky) way of doing it by iterating through the files directory and attempting to call Paper.book(file.name).destroy() while catching exceptions.

By the way, I love this library have been using it for years!