I have an Question. Releted SQLite database.
After updating the version number 1 to 2,my database updated by onUpgrade() .
1-I want to know ,i can use the older databases or not.
and onUpgrade() i use db.drop("previous table");
2-so after dropping that table can i take data from that or not.
please explain in detail.
Any good suggestion will be accepted.
Edited:- CAN WE USE OLDER VERSION OF DATABASE OR NOT.
No you cannot access anything from the old table after dropping – dropping a table is a like a delete operation – you aren’t supposed to easily regain access to it. From the first link I got from my search engine:
If you still need your previous data I recommend still working with that database and not dropping it until you feel it isn’t needed anymore. This SO answer goes into a lot of detail about how to properly upgrade a table. One interesting thing to note is that if you do decide to use
ALTER TABLE:So there are multiple ways of working with this –
ALTER TABLEis nice if you have a small thing to change, you don’t have to destroy everything, but if you need at least one column/row deleted you’re going to want to follow the answer and create a temp table.