From bcb96909c9b53c2ca5287433f2fef103b0ddf317 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 21 May 2017 23:30:30 +0200 Subject: Roster versioning --- libdino/src/service/database.vala | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'libdino/src/service/database.vala') diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 021d1c21..2836751f 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -115,6 +115,31 @@ public class Database : Qlite.Database { } } + public class RosterTable : Table { + public Column account_id = new Column.Integer("account_id"); + public Column jid = new Column.Text("jid"); + public Column name = new Column.Text("name"); + public Column subscription = new Column.Text("subscription"); + + internal RosterTable(Database db) { + base(db, "roster"); + init({account_id, jid, name, subscription}); + unique({account_id, jid}, "IGNORE"); + } + } + + public class AccountKeyValueTable : Table { + public Column account_id = new Column.Integer("account_id"); + public Column key = new Column.Text("key"); + public Column value = new Column.Text("value"); + + internal AccountKeyValueTable(Database db) { + base(db, "account_key_value"); + init({account_id, key, value}); + unique({account_id, key}, "IGNORE"); + } + } + public AccountTable account { get; private set; } public JidTable jid { get; private set; } public MessageTable message { get; private set; } @@ -122,6 +147,8 @@ public class Database : Qlite.Database { public ConversationTable conversation { get; private set; } public AvatarTable avatar { get; private set; } public EntityFeatureTable entity_feature { get; private set; } + public RosterTable roster { get; private set; } + public AccountKeyValueTable account_key_value { get; private set; } public Map jid_table_cache = new HashMap(); public Map jid_table_reverse = new HashMap(); @@ -136,7 +163,9 @@ public class Database : Qlite.Database { conversation = new ConversationTable(this); avatar = new AvatarTable(this); entity_feature = new EntityFeatureTable(this); - init({ account, jid, message, real_jid, conversation, avatar, entity_feature }); + roster = new RosterTable(this); + account_key_value = new AccountKeyValueTable(this); + init({ account, jid, message, real_jid, conversation, avatar, entity_feature, roster, account_key_value }); exec("PRAGMA synchronous=0"); } -- cgit v1.2.3-70-g09d2