simpleprovider icon indicating copy to clipboard operation
simpleprovider copied to clipboard

DB Recreation Error

Open tonespy opened this issue 10 years ago • 3 comments

I noticed something. If I drop a Table when I implement Logout in my app and come back in, the data is stored, but it can't be accessible unless I quit the app and then open it again. Do you know what might be the cause. I tried to log that the data is being stored and I noticed it's. But, then why isn't getting accessible on first try?

tonespy avatar Sep 10 '15 10:09 tonespy

Hi, you're right. This is currently not supported. Some background: The tables are created in the AbstractProvider's onCreate()-method which is called by the framework during app startup. In there we create a subclass of SQLiteOpenHelper that does all the magic. Unfortunately, we don't hold a reference to that helper so we cannot recreate the schema while the app is running.

For now, you may want to just purge the data but not the schema when your users log out.

If this is something that affects more users, I might come up with a better architecture, where things like that are supported.

bhurling avatar Sep 10 '15 16:09 bhurling

I would like to have this feature too. Background: I would like to do a migration by dropping all the data an recreating it with a new structure without an app restart.

artkoenig avatar Dec 04 '15 14:12 artkoenig

@artkoenig Can you explain why you want to migrate the db schema at runtime?

bhurling avatar Jan 05 '16 22:01 bhurling