Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid changing delete_server_after default for existing configurations #5995

Merged
merged 1 commit into from
Sep 26, 2024
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
23 changes: 23 additions & 0 deletions src/sql/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,29 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
.await?;
}

inc_and_check(&mut migration_version, 120)?;
if dbversion < migration_version {
// Core 1.143.0 changed the default for `delete_server_after`
// to delete immediately (`1`) for chatmail accounts that don't have multidevice
// and updating to `0` when backup is exported.
//
// Since we don't know if existing configurations
// are multidevice, we set `delete_server_after` for them
// to the old default of `0`, so only new configurations are
// affected by the default change.
//
// `INSERT OR IGNORE` works
// because `keyname` was made UNIQUE in migration 106.
sql.execute_migration(
"INSERT OR IGNORE INTO config (keyname, value)
SELECT 'delete_server_after', '0'
FROM config WHERE keyname='configured'
",
migration_version,
)
.await?;
}

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