agrosner / DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.
MIT License
4.87k stars 598 forks source link

how to update dbflow databse when i add some data only in table, not rename or add colume Ask Question #1680

Closed alijohar closed 3 years ago

alijohar commented 5 years ago

ISSUE_TEMPLATE

DBFlow Version: 4.24

Bug or Feature Request:

Description: I am using DBFLOW library, I have prepacked database. now I want to add new data to my database in two tables when I increase the version database and update my app, the old version of the database is still showing.

agrosner commented 3 years ago

Create a custom migration class, increment DB version and to the data migration. DBFlow runs all db migrations on create of DB and each subsequent diff. I believe from a prepackaged DB, you need to ensure its schema matches your current as migrations will not run.

agrosner commented 3 years ago

prepackaged is generally meant as a "quick-start" of the app, so you should ensure the prepackaged comes with the new data in the database, or when opening db, you schedule a transaction task to insert the data.