fixed faulty db creation on first install
This commit is contained in:
parent
dce001369d
commit
4e791c8a01
|
@ -27,10 +27,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
+ Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT,"
|
+ Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT,"
|
||||||
+ Contact.JID + " TEXT," + Contact.KEYS + " TEXT,"
|
+ Contact.JID + " TEXT," + Contact.KEYS + " TEXT,"
|
||||||
+ Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER,"
|
+ Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER,"
|
||||||
+ Contact.SYSTEMACCOUNT + " NUMBER, " + "FOREIGN KEY("
|
+ Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, "
|
||||||
+ Contact.ACCOUNT + ") REFERENCES " + Account.TABLENAME + "("
|
+ "FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
|
||||||
+ Account.UUID + ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT
|
+ Account.TABLENAME + "(" + Account.UUID
|
||||||
+ ", " + Contact.JID + ") ON CONFLICT REPLACE);";
|
+ ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", "
|
||||||
|
+ Contact.JID + ") ON CONFLICT REPLACE);";
|
||||||
|
|
||||||
public DatabaseBackend(Context context) {
|
public DatabaseBackend(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
@ -43,7 +44,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
+ " TEXT PRIMARY KEY," + Account.USERNAME + " TEXT,"
|
+ " TEXT PRIMARY KEY," + Account.USERNAME + " TEXT,"
|
||||||
+ Account.SERVER + " TEXT," + Account.PASSWORD + " TEXT,"
|
+ Account.SERVER + " TEXT," + Account.PASSWORD + " TEXT,"
|
||||||
+ Account.ROSTERVERSION + " TEXT," + Account.OPTIONS
|
+ Account.ROSTERVERSION + " TEXT," + Account.OPTIONS
|
||||||
+ " NUMBER, " + Account.KEYS + " TEXT)");
|
+ " NUMBER, " + Account.AVATAR + " TEXT, " + Account.KEYS
|
||||||
|
+ " TEXT)");
|
||||||
db.execSQL("create table " + Conversation.TABLENAME + " ("
|
db.execSQL("create table " + Conversation.TABLENAME + " ("
|
||||||
+ Conversation.UUID + " TEXT PRIMARY KEY, " + Conversation.NAME
|
+ Conversation.UUID + " TEXT PRIMARY KEY, " + Conversation.NAME
|
||||||
+ " TEXT, " + Conversation.CONTACT + " TEXT, "
|
+ " TEXT, " + Conversation.CONTACT + " TEXT, "
|
||||||
|
@ -58,10 +60,11 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
+ Message.TIME_SENT + " NUMBER, " + Message.COUNTERPART
|
+ Message.TIME_SENT + " NUMBER, " + Message.COUNTERPART
|
||||||
+ " TEXT, " + Message.TRUE_COUNTERPART + " TEXT,"
|
+ " TEXT, " + Message.TRUE_COUNTERPART + " TEXT,"
|
||||||
+ Message.BODY + " TEXT, " + Message.ENCRYPTION + " NUMBER, "
|
+ Message.BODY + " TEXT, " + Message.ENCRYPTION + " NUMBER, "
|
||||||
+ Message.STATUS + " NUMBER," + Message.TYPE
|
+ Message.STATUS + " NUMBER," + Message.TYPE + " NUMBER, "
|
||||||
+ " NUMBER, FOREIGN KEY(" + Message.CONVERSATION
|
+ Message.REMOTE_MSG_ID + " TEXT, FOREIGN KEY("
|
||||||
+ ") REFERENCES " + Conversation.TABLENAME + "("
|
+ Message.CONVERSATION + ") REFERENCES "
|
||||||
+ Conversation.UUID + ") ON DELETE CASCADE);");
|
+ Conversation.TABLENAME + "(" + Conversation.UUID
|
||||||
|
+ ") ON DELETE CASCADE);");
|
||||||
|
|
||||||
db.execSQL(CREATE_CONTATCS_STATEMENT);
|
db.execSQL(CREATE_CONTATCS_STATEMENT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue