Skip to main content

rehash_fingerprints

Function rehash_fingerprints 

Source
async fn rehash_fingerprints(pool: &SqlitePool) -> Result<(), Error>
Expand description

Re-fingerprints every book in all libraries using BLAKE3 content hashing.

The old fingerprint was derived from file metadata (mtime + size relative to the FAT32 epoch), which was unstable across timestamp changes. This migration computes a new content-based fingerprint for each file that is still present on disk and re-keys all associated database rows (reading states, thumbnails, TOC entries, authors, categories) to the new fingerprint, preserving user progress data.

Files that are no longer present on disk keep a canonicalized legacy fingerprint in the database so their data remains readable until the next import() scan removes them as orphans.

Migration ID: v2_rehash_fingerprints

To re-run this migration, delete its tracking row:

DELETE FROM _cadmus_migrations WHERE id = 'v2_rehash_fingerprints';