what is the correct way to upgrade sqllite db?

前端 未结 4 1398
予麋鹿
予麋鹿 2021-01-16 16:31
private static final String TABLE_MAIN_CREATE = \"CREATE TABLE IF NOT EXISTS \" + TABLE_MAIN_NAME + \" ( a INTEGER, b LONG, c TEXT, d TEXT, e DATETIME, f TEXT)\";
pr         


        
4条回答
  •  孤独总比滥情好
    2021-01-16 16:58

    You need not call onCreate in onUpgrade. Doing db.execSQL(TABLE_MAIN_UPGRADE) in enough for update. Now you should clear data of your application. To do this re-install the app or execute in android shell

    pm clear your.app.package
    

提交回复
热议问题