aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/persistance
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
commitcf00f3fade1e76ff9360e96d5505d49c7c89d5c4 (patch)
tree0617dcc0eff219a19e555aba6096e24d9ef2e30c /src/main/java/eu/siacs/conversations/persistance
parent84b2ce10b7a38aaaa9d2d3ee8ad4e1213402640f (diff)
happy hanukkah
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index 6879a068..55fcff2e 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -22,7 +22,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
private static DatabaseBackend instance = null;
private static final String DATABASE_NAME = "history";
- private static final int DATABASE_VERSION = 10;
+ private static final int DATABASE_VERSION = 11;
private static String CREATE_CONTATCS_STATEMENT = "create table "
+ Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, "
@@ -31,7 +31,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER,"
+ Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, "
+ Contact.LAST_PRESENCE + " TEXT, " + Contact.LAST_TIME + " NUMBER, "
- + "FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
+ + Contact.GROUPS + " TEXT, FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
+ Account.TABLENAME + "(" + Account.UUID
+ ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", "
+ Contact.JID + ") ON CONFLICT REPLACE);";
@@ -115,6 +115,12 @@ public class DatabaseBackend extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN "
+ Message.RELATIVE_FILE_PATH + " TEXT");
}
+ if (oldVersion < 11 && newVersion >= 11) {
+ db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN "
+ + Contact.GROUPS + " TEXT");
+ db.execSQL("delete from "+Contact.TABLENAME);
+ db.execSQL("update "+Account.TABLENAME+" set "+Account.ROSTERVERSION+" = NULL");
+ }
}
public static synchronized DatabaseBackend getInstance(Context context) {