Minor improvements.

This commit is contained in:
levlam 2023-07-18 18:20:43 +03:00
parent 6777ff5157
commit bdcc79b418
8 changed files with 19 additions and 14 deletions

View File

@ -36,7 +36,7 @@ Status init_dialog_db(SqliteDb &db, int32 version, KeyValueSyncInterface &binlog
version = 0;
}
if (version < static_cast<int32>(DbVersion::DialogDbCreated) || version > current_db_version()) {
if (version < static_cast<int32>(DbVersion::CreateDialogDb) || version > current_db_version()) {
TRY_STATUS(drop_dialog_db(db, version));
version = 0;
}
@ -104,7 +104,7 @@ Status init_dialog_db(SqliteDb &db, int32 version, KeyValueSyncInterface &binlog
// NB: must happen inside a transaction
Status drop_dialog_db(SqliteDb &db, int version) {
if (version < static_cast<int32>(DbVersion::DialogDbCreated)) {
if (version < static_cast<int32>(DbVersion::CreateDialogDb)) {
if (version != 0) {
LOG(WARNING) << "Drop old pmc dialog_db";
}

View File

@ -12,6 +12,8 @@
#include "td/telegram/SuggestedAction.h"
#include "td/telegram/Td.h"
#include "td/actor/actor.h"
#include "td/utils/buffer.h"
#include "td/utils/Status.h"

View File

@ -49,7 +49,7 @@ Status init_message_db(SqliteDb &db, int32 version) {
TRY_RESULT(has_table, db.has_table("messages"));
if (!has_table) {
version = 0;
} else if (version < static_cast<int32>(DbVersion::DialogDbCreated) || version > current_db_version()) {
} else if (version < static_cast<int32>(DbVersion::CreateDialogDb) || version > current_db_version()) {
TRY_STATUS(drop_message_db(db, version));
version = 0;
}
@ -142,19 +142,19 @@ Status init_message_db(SqliteDb &db, int32 version) {
version = current_db_version();
}
if (version < static_cast<int32>(DbVersion::MessageDbMediaIndex)) {
if (version < static_cast<int32>(DbVersion::AddMessageDbMediaIndex)) {
TRY_STATUS(db.exec("ALTER TABLE messages ADD COLUMN index_mask INT4"));
TRY_STATUS(add_media_indices(0, MESSAGE_DB_INDEX_COUNT_OLD));
}
if (version < static_cast<int32>(DbVersion::MessageDb30MediaIndex)) {
if (version < static_cast<int32>(DbVersion::AddMessageDb30MediaIndex)) {
TRY_STATUS(add_media_indices(MESSAGE_DB_INDEX_COUNT_OLD, MESSAGE_DB_INDEX_COUNT));
}
if (version < static_cast<int32>(DbVersion::MessageDbFts)) {
if (version < static_cast<int32>(DbVersion::AddMessageDbFts)) {
TRY_STATUS(db.exec("ALTER TABLE messages ADD COLUMN search_id INT8"));
TRY_STATUS(db.exec("ALTER TABLE messages ADD COLUMN text STRING"));
TRY_STATUS(add_fts());
}
if (version < static_cast<int32>(DbVersion::MessagesCallIndex)) {
if (version < static_cast<int32>(DbVersion::AddMessagesCallIndex)) {
TRY_STATUS(add_call_index());
}
if (version < static_cast<int32>(DbVersion::AddNotificationsSupport)) {

View File

@ -15,6 +15,7 @@
#include "td/telegram/MessageId.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/net/NetQueryDispatcher.h"
#include "td/telegram/SecretChatDb.h"
#include "td/telegram/SequenceDispatcher.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/TdDb.h"

View File

@ -11,7 +11,6 @@
#include "td/utils/StringBuilder.h"
#include "td/utils/tl_helpers.h"
#include <limits>
#include <type_traits>
namespace td {

View File

@ -35,6 +35,8 @@
#include "td/db/binlog/BinlogEvent.h"
#include "td/db/binlog/BinlogHelper.h"
#include "td/actor/MultiPromise.h"
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/format.h"
@ -945,7 +947,7 @@ StoryManager::~StoryManager() {
Scheduler::instance()->destroy_on_scheduler(G()->get_gc_scheduler_id(), story_full_id_to_file_source_id_, stories_,
stories_by_global_id_, inaccessible_story_full_ids_,
deleted_story_full_ids_, failed_to_load_story_full_ids_, story_messages_,
active_stories_, max_read_story_ids_);
active_stories_, max_read_story_ids_, failed_to_load_active_stories_);
}
void StoryManager::start_up() {

View File

@ -66,11 +66,11 @@ enum class Version : int32 {
};
enum class DbVersion : int32 {
DialogDbCreated = 3,
MessageDbMediaIndex,
MessageDb30MediaIndex,
MessageDbFts,
MessagesCallIndex,
CreateDialogDb = 3,
AddMessageDbMediaIndex,
AddMessageDb30MediaIndex,
AddMessageDbFts,
AddMessagesCallIndex,
FixFileRemoteLocationKeyBug,
AddNotificationsSupport,
AddFolders,

View File

@ -11,6 +11,7 @@
#include "td/telegram/MessageId.h"
#include "td/telegram/secret_api.h"
#include "td/telegram/SecretChatActor.h"
#include "td/telegram/SecretChatDb.h"
#include "td/telegram/SecretChatId.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"