diff --git a/td/telegram/DialogDb.cpp b/td/telegram/DialogDb.cpp index 80a7a559..a37a8e07 100644 --- a/td/telegram/DialogDb.cpp +++ b/td/telegram/DialogDb.cpp @@ -75,7 +75,7 @@ Status init_dialog_db(SqliteDb &db, int32 version, bool &was_created) { TRY_STATUS(db.exec("DROP INDEX IF EXISTS dialog_by_dialog_order")); TRY_STATUS(db.exec("ALTER TABLE dialogs ADD COLUMN folder_id INT4")); TRY_STATUS(add_dialogs_in_folder_index()); - TRY_STATUS(db.exec("UPDATE dialogs SET folder_id = 0 WHERE dialog_id < -1500000000000 AND dialog_order != 0")); + TRY_STATUS(db.exec("UPDATE dialogs SET folder_id = 0 WHERE dialog_id < -1500000000000 AND dialog_order > 0")); } return Status::OK(); @@ -129,7 +129,7 @@ class DialogDbImpl : public DialogDbSyncInterface { TRY_RESULT_ASSIGN( get_secret_chat_count_stmt_, db_.get_statement( - "SELECT COUNT(*) FROM dialogs WHERE folder_id = ?1 AND dialog_order != 0 AND dialog_id < -1500000000000")); + "SELECT COUNT(*) FROM dialogs WHERE folder_id = ?1 AND dialog_order > 0 AND dialog_id < -1500000000000")); // LOG(ERROR) << get_dialog_stmt_.explain().ok(); // LOG(ERROR) << get_dialogs_stmt_.explain().ok();