Expand description
Runtime migrations for the library subsystem.
Each migration is registered automatically at startup via the crate::migration!
macro and tracked in the _cadmus_migrations table.
ยงRegistered migrations
| Module | Migration ID |
|---|---|
import_legacy_filesystem_data::MIGRATION_ID | v1_import_legacy_filesystem_data |
rehash_fingerprints::MIGRATION_ID | v2_rehash_fingerprints |
Modulesยง
- import_
legacy_ filesystem_ data - Module generated by the
crate::migration!macro. - rehash_
fingerprints - Module generated by the
crate::migration!macro.
Functionsยง
- canonicalize_
legacy_ ๐fingerprints - delete_
thumbnail_ ๐previews - Removes
.thumbnail-previews/from the library directory. - ensure_
library ๐ - Ensures the library row exists and returns its id.
- ensure_
stub_ ๐book - Inserts a stub
booksrow and alibrary_booksassociation forfpif they do not already exist. - import_
legacy_ ๐filesystem_ data - Imports book metadata from
.metadata.jsonand reading progress from.reading-states/<fingerprint>.jsoninto SQLite for every library path listed inSettings.toml. Covers both legacy library modes: - import_
library ๐ - Imports all books and reading states from a single library directory.
- import_
metadata_ ๐entries - Imports all entries from a
.metadata.jsonfile into the database. - import_
orphan_ ๐reading_ states - Imports reading states from
.reading-states/that are not inalready_imported. - insert_
book ๐ - insert_
reading_ ๐state - insert_
rekeyed_ ๐book - insert_
toc_ ๐entries - load_
metadata ๐ - mark_
library_ ๐imported - Renames
.metadata.jsonand.reading-states/to their.importedsuffixed equivalents so that subsequent runs of the migration skip this library. - merge_
book_ ๐authors - merge_
book_ ๐categories - merge_
duplicate_ ๐book_ data - merge_
library_ ๐books - merge_
reading_ ๐states - merge_
thumbnails ๐ - merge_
toc_ ๐entries - move_
rekeyed_ ๐book_ data - rehash_
fingerprints ๐ - Re-fingerprints every book in all libraries using BLAKE3 content hashing.
- rekey_
book ๐ - Re-keys a single book row from
old_fptonew_fp, preserving all associated data (reading state, thumbnails, TOC, authors, categories).