From 4e791c8a01b1c2eee1b6a5ba870085e924337f6b Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Sun, 24 Aug 2014 20:53:13 +0200 Subject: fixed faulty db creation on first install --- .../conversations/persistance/DatabaseBackend.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index 20cc6fb75..62736ffa3 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -27,10 +27,11 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT," + Contact.JID + " TEXT," + Contact.KEYS + " TEXT," + Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER," - + Contact.SYSTEMACCOUNT + " NUMBER, " + "FOREIGN KEY(" - + Contact.ACCOUNT + ") REFERENCES " + Account.TABLENAME + "(" - + Account.UUID + ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT - + ", " + Contact.JID + ") ON CONFLICT REPLACE);"; + + Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, " + + "FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES " + + Account.TABLENAME + "(" + Account.UUID + + ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", " + + Contact.JID + ") ON CONFLICT REPLACE);"; public DatabaseBackend(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); @@ -43,7 +44,8 @@ public class DatabaseBackend extends SQLiteOpenHelper { + " TEXT PRIMARY KEY," + Account.USERNAME + " TEXT," + Account.SERVER + " TEXT," + Account.PASSWORD + " TEXT," + Account.ROSTERVERSION + " TEXT," + Account.OPTIONS - + " NUMBER, " + Account.KEYS + " TEXT)"); + + " NUMBER, " + Account.AVATAR + " TEXT, " + Account.KEYS + + " TEXT)"); db.execSQL("create table " + Conversation.TABLENAME + " (" + Conversation.UUID + " TEXT PRIMARY KEY, " + Conversation.NAME + " TEXT, " + Conversation.CONTACT + " TEXT, " @@ -58,10 +60,11 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Message.TIME_SENT + " NUMBER, " + Message.COUNTERPART + " TEXT, " + Message.TRUE_COUNTERPART + " TEXT," + Message.BODY + " TEXT, " + Message.ENCRYPTION + " NUMBER, " - + Message.STATUS + " NUMBER," + Message.TYPE - + " NUMBER, FOREIGN KEY(" + Message.CONVERSATION - + ") REFERENCES " + Conversation.TABLENAME + "(" - + Conversation.UUID + ") ON DELETE CASCADE);"); + + Message.STATUS + " NUMBER," + Message.TYPE + " NUMBER, " + + Message.REMOTE_MSG_ID + " TEXT, FOREIGN KEY(" + + Message.CONVERSATION + ") REFERENCES " + + Conversation.TABLENAME + "(" + Conversation.UUID + + ") ON DELETE CASCADE);"); db.execSQL(CREATE_CONTATCS_STATEMENT); } -- cgit v1.2.3