Why not use IMAP for long-term message storage?

If you are editing the database manually anyway, you can rewind imap_sync.uid_next to 1 and Delta Chat will redownload all messages from the inbox. It will detect duplicates, so already downloaded messages will not appear twice.

Alternatively, create a folder on the server, copy or move all messages there, then move them back. They will get new UIDs and will be downloaded: