Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/sql/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,37 @@ ALTER TABLE contacts ADD COLUMN name_normalized TEXT;
.await?;
}

inc_and_check(&mut migration_version, 144)?;
if dbversion < migration_version {
sql.execute_migration_transaction(
|transaction| {
let is_chatmail = transaction
.query_row(
"SELECT value FROM config WHERE keyname='is_chatmail'",
(),
|row| {
let value: String = row.get(0)?;
Ok(value)
},
)
.optional()?
.as_deref()
== Some("1");

if is_chatmail {
transaction.execute_batch(
"DELETE FROM config WHERE keyname='only_fetch_mvbox';
DELETE FROM config WHERE keyname='show_emails';
UPDATE config SET value='0' WHERE keyname='mvbox_move'",
)?;
}
Ok(())
},
migration_version,
)
.await?;
}
Comment on lines +1469 to +1498
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration resets chatmail profile options that should not be set, but there is no test coverage for this migration. Consider adding a test case similar to the existing migration tests that:

  1. Sets up a chatmail profile with these config values set incorrectly
  2. Runs the migration
  3. Verifies that only_fetch_mvbox and show_emails are deleted and mvbox_move is set to '0'

This would help ensure the migration works correctly and prevent regressions.

Copilot uses AI. Check for mistakes.

let new_version = sql
.get_raw_config_int(VERSION_CFG)
.await?
Expand Down