diff options
-rw-r--r-- | libdino/src/service/database.vala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 841518d8..d3bc71c2 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino { public class Database : Qlite.Database { - private const int VERSION = 15; + private const int VERSION = 16; public class AccountTable : Table { public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -186,7 +186,7 @@ public class Database : Qlite.Database { internal AvatarTable(Database db) { base(db, "contact_avatar"); init({jid_id, account_id, hash, type_}); - unique({jid_id, account_id}, "REPLACE"); + unique({jid_id, account_id, type_}, "REPLACE"); } } @@ -380,6 +380,14 @@ public class Database : Qlite.Database { error("Failed to upgrade to database version 15: %s", e.message); } } + if (oldVersion < 16) { + try { + exec("DROP TABLE contact_avatar"); + avatar.create_table_at_version(VERSION); + } catch (Error e) { + error("Failed to upgrade to database version 16: %s", e.message); + } + } } public ArrayList<Account> get_accounts() { |