In the application I'm working on, I have to save the data from a specific table when the application is updated. This action must happen before the table is dropped in the onUpgrade method. I need to do this because when the application is updated I want the user to remain logged in to the system after the upgrade. User data is the only data I want to reuse. my onUpgrade method looks like this:
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
TableUtils.dropTable(connectionSource, User.class, true);
... other tables
// after we drop the old databases, we create the new ones
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
How can I implement this persistence?