I have an app in Google Play store and I'm working on new version of it. There will be change in SQLite database scheme (new tables) + new ContentProviders.
I consider how to properly solve upgrade of database structure so that users when upgrading my app doesn't lose their current content and also will have created new tables.
Should I change: * private static final int DATABASE_VERSION = 1; to: private static final int DATABASE_VERSION = 2; *
and somehow in onUpgrade() method place code that if detect that oldVersion was 1 and newVersion is 2. Will create new tables.
Now I have some dumb code there where if onUpgrade has been called the database has been destroyed and recreated... but I think that this method has never been called cause DATABASE_VERSION hasn't been changed. And I just uninstall and reinstall app while testing.
What is the best practice?
private static final int DATABASE_VERSION = 1;
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
enter code here
}