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: recreate smtp table with AUTOINCREMENT #4390

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
18 changes: 18 additions & 0 deletions src/sql/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down