It is possible to save the data from a table before my model changes the database?
For example i rename a column and will not lose the data. So i.e. i want to fetch all data from column c1, rename my column to c2 and write all data back.
It is possible to save the data from a table before my model changes the database?
For example i rename a column and will not lose the data. So i.e. i want to fetch all data from column c1, rename my column to c2 and write all data back.
Sqlite does not support the renaming of columns so this will not work under Android. You can certainly add an additional column however. There is some good documentation on schema changes under Android/ORMLite. See this page:
For example, you can do the following schema updates:
Here's a quote from the ORMLite documentation: "You can’t rename or remove a column or change the constraints".
So your choices are:
Database upgrades are always nervous affairs (need lots of error handling, lots of testing), frankly if the name is the only thing that concerns you, I'd leave it alone (option 1). If you really need to change it then option 2 is low risk but leaves a 'dead' column and data lying around. Option 3 may be your choice if, for example, the data is a significant percentage of the overall database size.