sql: Add migration for bad message-id data in the database

This commit is contained in:
Michael Gratton 2020-08-13 15:50:07 +10:00
parent d280bcbbeb
commit 33801f22ef
2 changed files with 8 additions and 1 deletions

7
sql/version-027.sql Normal file
View file

@ -0,0 +1,7 @@
--
-- Rebuild corrupted message ids.
--
UPDATE MessageTable
SET message_id = '<' || message_id || '>'
WHERE (message_id NOT LIKE '<%') AND (message_id NOT LIKE ' <%');

View file

@ -107,7 +107,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
); );
db.open.end(async_result()); db.open.end(async_result());
assert_equal<int?>(db.get_schema_version(), 26, "Post-upgrade version"); assert_equal<int?>(db.get_schema_version(), 27, "Post-upgrade version");
// Since schema v22 deletes the re-creates all attachments, // Since schema v22 deletes the re-creates all attachments,
// attachment 12 should no longer exist on the file system and // attachment 12 should no longer exist on the file system and