Update Sqlite.java

Changes for users where the table is already created by adding a constraint on the table. Need to be tested on the device having a duplicate value
This commit is contained in:
Thomas 2018-02-22 19:04:23 +01:00 committed by GitHub
parent f9c740ef18
commit 06fa2209ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -26,7 +26,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class Sqlite extends SQLiteOpenHelper {
public static final int DB_VERSION = 10;
public static final int DB_VERSION = 11;
public static final String DB_NAME = "mastodon_etalab_db";
public static SQLiteDatabase db;
private static Sqlite sInstance;
@ -206,6 +206,8 @@ public class Sqlite extends SQLiteOpenHelper {
case 9:
db.execSQL("DROP TABLE IF EXISTS " + TABLE_STATUSES_CACHE);
db.execSQL(CREATE_TABLE_STATUSES_CACHE);
case 10:
db.execSQL("ALTER TABLE " + TABLE_STATUSES_CACHE + " ADD CONSTRAINT statusid_instance UNIQUE (" + COL_INSTANCE + "," + COL_STATUS_ID + ")");
default:
break;
}