Use ActiveAndroid on existing database-content
Asked Answered
O

1

12

I developed an Android-App where I saved data in a SQLite database using the SQLiteOpenHelper.

I am wondering if I could update my app by using ActiveAndroid, but in a way that the user data previously stored in the database will be preserved.

Is that possible?

Overflight answered 17/2, 2015 at 19:30 Comment(5)
Have you found a solution?Zymase
Unfortunately not, no; I haven't been searching for that long, though, so there might still be hope :)Overflight
you can always migrate the content on your old database to a new one that uses ActiveAndroid, after which you can remove the old one.Cherida
I think this problem should have implemented by ActiveAndroidCuirassier
Unfortunately ActiveAndroid is no longer being maintained, and I doubt that any future updates will be coming out in the future.Helbonia
H
6

You would have to perform a data migration during runtime after the user upgrades to the newest version of the app. The process could be broken down into the following steps, I have also assigned database version values to each step.

  1. The user has all of their data stored in a SQLite database and has not upgraded their app yet. [DB = SQlite v1]

  2. On upgrade, when the user is upgrading to the next version of the app read all data from the old SQLite database and store it into the ActiveAndroid database. [DB = SQLite v1 and ActiveAndroid v1]

  3. Once all of the data has been migrated to the new ActiveAndroid database then delete all tables of the SQLite database so that you don't use extra storage space that you do not need. [DB = SQLite v2 and ActiveAndroid v1]

  4. In the next release you can then assume that user has had their data fully migrated and at this point it is finally safe to remove all code that was previously referencing the SQLite database. [DB = ActiveAndroid v2]

Helbonia answered 20/6, 2015 at 5:13 Comment(2)
For upgrade the database in the next version of app create a Singleton class so that that the copied database will have only one instance. It will update easily.Loup
D, this makes sense to me... do you think it answers your question?Fullback

© 2022 - 2024 — McMap. All rights reserved.