Skip to content
Advertisement

Unable to migrate android sqllite database

I have been running the onUpgrade method without issues, until this column:

JavaScript

I have updated the database version. The above has been simplified to try and make sure that nothing else is causing this column to not be created.

Note that if I uninstall the app and reinstall the app, then it runs without issue.

How would I go about debugging this issue further?

I imagine I need to provide more information, but I’m not sure what would help. Every idea that I have had, I have tried.

The error is:

JavaScript

Advertisement

Answer

From https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#beginTransaction():

The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

So call:

JavaScript

before:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement