upgrading database

后端 未结 1 930
眼角桃花
眼角桃花 2021-01-27 21:08

I have an app already in google store.I am using a builtin database having 3 tables and copying it on first launch of app. Now i want to do upgrade to the app and add another ta

1条回答
  •  借酒劲吻你
    2021-01-27 22:01

    super(context, DB_NAME, null, 1);
    

    in this statement last argument is database version.. set it to 2 for new updated APK. so existing user can have newly added table Or Column.

    on updated apk onUpgrade will call. and there you can copy database from asset. but than exisiting user will have loss of data.. so best option is to add table dynamically in database.

    0 讨论(0)
提交回复
热议问题