Recreate avatar database table, fixes unique constraint
This commit is contained in:
parent
0beb592c5a
commit
6d41071da1
|
@ -7,7 +7,7 @@ using Dino.Entities;
|
||||||
namespace Dino {
|
namespace Dino {
|
||||||
|
|
||||||
public class Database : Qlite.Database {
|
public class Database : Qlite.Database {
|
||||||
private const int VERSION = 15;
|
private const int VERSION = 16;
|
||||||
|
|
||||||
public class AccountTable : Table {
|
public class AccountTable : Table {
|
||||||
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
|
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) {
|
internal AvatarTable(Database db) {
|
||||||
base(db, "contact_avatar");
|
base(db, "contact_avatar");
|
||||||
init({jid_id, account_id, hash, type_});
|
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);
|
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() {
|
public ArrayList<Account> get_accounts() {
|
||||||
|
|
Loading…
Reference in a new issue