I've just nearly had this problem, but luckily I had a very recent backup.
My solution would be for calibre to also store an *opf file in the directory with each of the entries, storing all the metadata, so it would be able to re-import the data if needed.
See this thread, for details
https://www.mobileread.com/forums/showthread.php?t=99193