From d625058d76efc9e344dd5e1239a4b040a7d2519a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 17 Sep 2025 17:47:36 +0200 Subject: Message correction: Use occupant ids, handle correction-before-message --- libdino/src/service/database.vala | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libdino/src/service/database.vala') diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index e47e24e9..58ff3b14 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 = 29; + private const int VERSION = 30; public class AccountTable : Table { public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -103,6 +103,19 @@ public class Database : Qlite.Database { } } + public class MessageOccupantId : Table { + public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; + public Column message_id = new Column.Integer("message_id") { not_null = true }; + public Column occupant_id = new Column.Integer("occupant_id") { not_null = true }; + + internal MessageOccupantId(Database db) { + base(db, "message_occupant_id"); + init({id, message_id, occupant_id}); + + index("message_id_occupant_id", { message_id, occupant_id }); + } + } + public class BodyMeta : Table { public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; public Column message_id = new Column.Integer("message_id"); @@ -440,6 +453,7 @@ public class Database : Qlite.Database { public EntityTable entity { get; private set; } public ContentItemTable content_item { get; private set; } public MessageTable message { get; private set; } + public MessageOccupantId message_occupant_id { get; private set; } public BodyMeta body_meta { get; private set; } public ReplyTable reply { get; private set; } public MessageCorrectionTable message_correction { get; private set; } @@ -473,6 +487,7 @@ public class Database : Qlite.Database { entity = new EntityTable(this); content_item = new ContentItemTable(this); message = new MessageTable(this); + message_occupant_id = new MessageOccupantId(this); body_meta = new BodyMeta(this); message_correction = new MessageCorrectionTable(this); reply = new ReplyTable(this); @@ -494,7 +509,7 @@ public class Database : Qlite.Database { settings = new SettingsTable(this); account_settings = new AccountSettingsTable(this); conversation_settings = new ConversationSettingsTable(this); - init({ account, jid, entity, content_item, message, body_meta, message_correction, reply, real_jid, occupantid, file_transfer, file_hashes, file_thumbnails, sfs_sources, call, call_counterpart, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, reaction, settings, account_settings, conversation_settings }); + init({ account, jid, entity, content_item, message, message_occupant_id, body_meta, message_correction, reply, real_jid, occupantid, file_transfer, file_hashes, file_thumbnails, sfs_sources, call, call_counterpart, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, reaction, settings, account_settings, conversation_settings }); try { exec("PRAGMA journal_mode = WAL"); -- cgit v1.3