mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
do not SELECT * on old tables to fill new ones (#3842)
* do not `SELECT *` on old tables to fill new ones the old table may contain deprecrated columns for whatever reason; as a result the query fails as the statement tries to insert eg. 16 columns into 12 colums (concrete error for acpeerstate that have several deprecated columns) * update CHANGELOG
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
### Fixes
|
### Fixes
|
||||||
- Set read/write timeouts for IMAP over SOCKS5 #3833
|
- Set read/write timeouts for IMAP over SOCKS5 #3833
|
||||||
- Treat attached PGP keys as peer keys with mutual encryption preference #3832
|
- Treat attached PGP keys as peer keys with mutual encryption preference #3832
|
||||||
|
- fix migration of old databases #3842
|
||||||
|
|
||||||
|
|
||||||
## 1.103.0
|
## 1.103.0
|
||||||
|
|||||||
@@ -637,7 +637,11 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid);
|
|||||||
verified_key_fingerprint TEXT DEFAULT '',
|
verified_key_fingerprint TEXT DEFAULT '',
|
||||||
UNIQUE (addr) -- Only one peerstate per address
|
UNIQUE (addr) -- Only one peerstate per address
|
||||||
);
|
);
|
||||||
INSERT OR IGNORE INTO new_acpeerstates SELECT * FROM acpeerstates;
|
INSERT OR IGNORE INTO new_acpeerstates SELECT
|
||||||
|
id, addr, last_seen, last_seen_autocrypt, public_key, prefer_encrypted,
|
||||||
|
gossip_timestamp, gossip_key, public_key_fingerprint,
|
||||||
|
gossip_key_fingerprint, verified_key, verified_key_fingerprint
|
||||||
|
FROM acpeerstates;
|
||||||
DROP TABLE acpeerstates;
|
DROP TABLE acpeerstates;
|
||||||
ALTER TABLE new_acpeerstates RENAME TO acpeerstates;
|
ALTER TABLE new_acpeerstates RENAME TO acpeerstates;
|
||||||
CREATE INDEX acpeerstates_index1 ON acpeerstates (addr);
|
CREATE INDEX acpeerstates_index1 ON acpeerstates (addr);
|
||||||
@@ -652,7 +656,7 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid);
|
|||||||
if dbversion < 95 {
|
if dbversion < 95 {
|
||||||
sql.execute_migration(
|
sql.execute_migration(
|
||||||
"CREATE TABLE new_chats_contacts (chat_id INTEGER, contact_id INTEGER, UNIQUE(chat_id, contact_id));\
|
"CREATE TABLE new_chats_contacts (chat_id INTEGER, contact_id INTEGER, UNIQUE(chat_id, contact_id));\
|
||||||
INSERT OR IGNORE INTO new_chats_contacts SELECT * FROM chats_contacts;\
|
INSERT OR IGNORE INTO new_chats_contacts SELECT chat_id, contact_id FROM chats_contacts;\
|
||||||
DROP TABLE chats_contacts;\
|
DROP TABLE chats_contacts;\
|
||||||
ALTER TABLE new_chats_contacts RENAME TO chats_contacts;\
|
ALTER TABLE new_chats_contacts RENAME TO chats_contacts;\
|
||||||
CREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);\
|
CREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);\
|
||||||
|
|||||||
Reference in New Issue
Block a user