diff options
author | fiaxh <git@lightrise.org> | 2020-06-11 00:03:30 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-06-11 00:03:30 +0200 |
commit | 6d41071da1f01678b9ab449ed7f00391067da43a (patch) | |
tree | c7ac8616a92c935672c776855b834a6e1b2a6ada /libdino | |
parent | 0beb592c5a6a2767e11a892bdb5ac9bcc5283c38 (diff) | |
download | dino-6d41071da1f01678b9ab449ed7f00391067da43a.tar.gz dino-6d41071da1f01678b9ab449ed7f00391067da43a.zip |
Recreate avatar database table, fixes unique constraint
Diffstat (limited to 'libdino')
-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() { |