Remove support for dropping old PMC-based chat database.
This commit is contained in:
parent
97a401cd04
commit
93ddc9c3db
@ -34,9 +34,7 @@ Status init_dialog_db(SqliteDb &db, int32 version, KeyValueSyncInterface &binlog
|
||||
TRY_RESULT(has_table, db.has_table("dialogs"));
|
||||
if (!has_table) {
|
||||
version = 0;
|
||||
}
|
||||
|
||||
if (version < static_cast<int32>(DbVersion::CreateDialogDb) || version > current_db_version()) {
|
||||
} else if (version > current_db_version()) {
|
||||
TRY_STATUS(drop_dialog_db(db, version));
|
||||
version = 0;
|
||||
}
|
||||
@ -104,17 +102,8 @@ 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::CreateDialogDb)) {
|
||||
if (version != 0) {
|
||||
LOG(WARNING) << "Drop old pmc dialog_db";
|
||||
}
|
||||
SqliteKeyValue kv;
|
||||
kv.init_with_connection(db.clone(), "common").ensure();
|
||||
kv.erase_by_prefix("di");
|
||||
}
|
||||
|
||||
if (version != 0) {
|
||||
LOG(WARNING) << "Drop dialog_db " << tag("version", version) << tag("current_db_version", current_db_version());
|
||||
LOG(WARNING) << "Drop chat database " << tag("version", version) << tag("current_db_version", current_db_version());
|
||||
}
|
||||
auto status = db.exec("DROP TABLE IF EXISTS dialogs");
|
||||
TRY_STATUS(db.exec("DROP TABLE IF EXISTS notification_groups"));
|
||||
|
@ -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::CreateDialogDb) || version > current_db_version()) {
|
||||
} else if (version > current_db_version()) {
|
||||
TRY_STATUS(drop_message_db(db, version));
|
||||
version = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user