diff --git a/CHANGELOG.md b/CHANGELOG.md index d9c47ceb8..654d160dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Make the bots automatically accept group chat contact requests. #4377 - Fetch at most 100 existing messages even if EXISTS was not received. #4383 - jsonrpc: typescript client: fix types of events in event emitter +- Recreate `smtp` table with AUTOINCREMENT `id`. #4390 - delete `smtp` rows when message sending is cancelled #4391 diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 9493164ea..7a6e1f2a3 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -711,6 +711,24 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid); ) .await?; } + if dbversion < 101 { + // Recreate `smtp` table with autoincrement. + // rfc724_mid index is not recreated, because it is not used. + sql.execute_migration( + "DROP TABLE smtp; + CREATE TABLE smtp ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + rfc724_mid TEXT NOT NULL, -- Message-ID + mime TEXT NOT NULL, -- SMTP payload + msg_id INTEGER NOT NULL, -- ID of the message in `msgs` table + recipients TEXT NOT NULL, -- List of recipients separated by space + retries INTEGER NOT NULL DEFAULT 0 -- Number of failed attempts to send the message + ); + ", + 101, + ) + .await?; + } let new_version = sql .get_raw_config_int(VERSION_CFG)