I have an sqlite database table with a primary ID and some columns. Now I wanted to add an additional column with the same value as the primary ID.
my_id integer primary key, ..., sort_order INTEGER
To do this, I excecute the following in onUpgrade() of my SQLite Helper
if (oldVersion < 24) {
database.execSQL("ALTER TABLE " + "my_table" + " ADD COLUMN " + "sort_order" + " INTEGER");
database.execSQL("UPDATE my_table SET sort_order = my_id");
}
This worked fine for me and also for the beta users of this app.
But now that I released this app to production, I got a large number of crash reports with
android.database.sqlite.SQLiteException: no such column: my_id(code 1): , while compiling: UPDATE my_table SET sort_order = my_id
Any idea what could be happening here? I rolled back to the previous version of my app and updated again, but I can not reproduce this crash on any of my devices!
Aucun commentaire:
Enregistrer un commentaire