diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index a32bd0abd..1b478961d 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -10,7 +10,7 @@ use crate::provider::get_provider_by_domain; use crate::sql::Sql; use crate::tools::EmailAddress; -const DBVERSION: i32 = 68; +const DBVERSION: i32 = 69; const VERSION_CFG: &str = "dbversion"; const TABLES: &str = include_str!("./tables.sql"); @@ -616,6 +616,15 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid); ) .await?; } + if dbversion < 94 { + sql.execute_migration( + r#" +ALTER TABLE chats ADD COLUMN encryption_modus INTEGER DEFAULT 0; +ALTER TABLE msgs ADD COLUMN encryption_modus INTEGER DEFAULT 0;"#, + 94, + ) + .await?; + } let new_version = sql .get_raw_config_int(VERSION_CFG) diff --git a/src/sql/tables.sql b/src/sql/tables.sql index d105dddec..c52c29823 100644 --- a/src/sql/tables.sql +++ b/src/sql/tables.sql @@ -38,8 +38,7 @@ CREATE TABLE chats ( locations_last_sent INTEGER DEFAULT 0, created_timestamp INTEGER DEFAULT 0, muted_until INTEGER DEFAULT 0, - ephemeral_timer INTEGER, - encryption_modus INTEGER DEFAULT 0 + ephemeral_timer INTEGER ); CREATE INDEX chats_index1 ON chats (grpid); CREATE INDEX chats_index2 ON chats (archived); @@ -93,8 +92,7 @@ CREATE TABLE msgs ( -- deleted. It is convenient to store it here because UI -- needs this value to display how much time is left until -- the message is deleted. - ephemeral_timestamp INTEGER DEFAULT 0, - encryption_modus INTEGER DEFAULT 0 + ephemeral_timestamp INTEGER DEFAULT 0 ); CREATE INDEX msgs_index1 ON msgs (rfc724_mid);