在现有数据库内容上使用ActiveAndroid [英] Use ActiveAndroid on existing database-content

查看:205
本文介绍了在现有数据库内容上使用ActiveAndroid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Android应用程序,我在SQLite数据库中使用SQLiteOpenHelper保存数据。



我想知道是否可以使用 ActiveAndroid ,但是以保存以前存储在数据库中的用户数据的方式。



是否可能?

解决方案

在用户升级到最新版本之后,您必须在运行时执行数据迁移应用程序。该过程可以细分为以下步骤,我还为每个步骤分配了数据库版本值。


  1. 用户将其所有数据存储在SQLite数据库中,尚未升级其应用程序。 [DB = SQlite v1]


  2. 升级时,当用户升级到下一个版本的
    应用程序时,数据库并将其存储到
    ActiveAndroid数据库中。 [DB = SQLite v1和ActiveAndroid v1]


  3. 一旦所有数据已迁移到新的ActiveAndroid数据库,然后删除SQLite数据库的所有表,您不使用您不需要的额外存储空间。 [DB = SQLite v2和ActiveAndroid v1]


  4. 在下一个版本中,您可以假定用户已完全迁移其数据,安全地删除以前引用SQLite数据库的所有代码。 [DB = ActiveAndroid v2]



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?

解决方案

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]

这篇关于在现有数据库内容上使用ActiveAndroid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆