mercredi 21 octobre 2015

Android - On Upgrade For SQLite DataBase

I have a application which has a SQLite Database, it's on the play store and recently I've released some updates which includes adding columns to a table in the database

I now want to do another release, which again has another column added to a table, however the problem I'm having is that I don't know if everyone has downloaded the update therefore

If everyone hasn't upgraded if I remove the old changes to database they won't get them and the app will crash

If I leave in the updates and someone who has installed the update tries to update it will say that the column already exists and then won't do the update which is actually needed and the app will crash

I'm guessing that the best thing to do is a try/catch at every alter in the database so that if one fails it will still go to the next one

However I'm wondering if there is a actually 'correct' way of dealing with this issue

Thanks

Aucun commentaire:

Enregistrer un commentaire