Android database approach for future updates

后端 未结 4 1927
一向
一向 2021-01-16 19:09

What is the best way to work with the sqlite database in android?

The sqlite database file (copy it for the first time into the application environment)

4条回答
  •  情书的邮戳
    2021-01-16 19:36

    If you don't expect to have your db updated by user interaction, the file might be the best option, especially in the case that you have a lot of data to insert (file copying vs a bunch of inserts).

    On the other hand, if you expect to have some data altered or added by the user, the file approach will work only in the first release.

    Any time you will need to update your schema or add new data (releasing an upgrade), you will need to consider that the existing data might be changed or enriched by some stuff that the users will expect to find AFTER the upgrade.

    So replacing the file is not an option anymore.

    In case you need to use the sqllite helper approach, I'd love to hear some feedbacks on my sqllite helper code generator that you can find here: github

提交回复
热议问题