Skip to content

Commit

Permalink
Fix bug in database
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod committed May 29, 2024
1 parent 0566f75 commit a5abf0a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DelMessageStore extends SQLiteOpenHelper {
private static DelMessageStore mInstance;

private DelMessageStore(@NonNull Context context) {
super(context, "delmessages.db", null, 2);
super(context, "delmessages.db", null, 3);
}

public static DelMessageStore getInstance(Context ctx) {
Expand Down Expand Up @@ -64,13 +64,13 @@ public long getTimestampByMessageId(String msgid) {

@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS delmessages (_id INTEGER PRIMARY KEY AUTOINCREMENT, jid TEXT, msgid TEXT, UNIQUE(jid, msgid))");
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS delmessages (_id INTEGER PRIMARY KEY AUTOINCREMENT, jid TEXT, msgid TEXT, timestamp INTEGER DEFAULT 0, UNIQUE(jid, msgid))");
}


@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
if (oldVersion < 2) {
if (oldVersion < 3) {
sqLiteDatabase.execSQL("ALTER TABLE delmessages ADD COLUMN timestamp INTEGER DEFAULT 0;");
}
}
Expand Down

0 comments on commit a5abf0a

Please sign in to comment.