Skip to main content

Module migrations

Module migrations 

Source
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

ModuleMigration ID
import_legacy_filesystem_data::MIGRATION_IDv1_import_legacy_filesystem_data
rehash_fingerprints::MIGRATION_IDv2_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 books row and a library_books association for fp if they do not already exist.
import_legacy_filesystem_data ๐Ÿ”’
Imports book metadata from .metadata.json and reading progress from .reading-states/<fingerprint>.json into SQLite for every library path listed in Settings.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.json file into the database.
import_orphan_reading_states ๐Ÿ”’
Imports reading states from .reading-states/ that are not in already_imported.
insert_book ๐Ÿ”’
insert_reading_state ๐Ÿ”’
insert_rekeyed_book ๐Ÿ”’
insert_toc_entries ๐Ÿ”’
load_metadata ๐Ÿ”’
mark_library_imported ๐Ÿ”’
Renames .metadata.json and .reading-states/ to their .imported suffixed 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_fp to new_fp, preserving all associated data (reading state, thumbnails, TOC, authors, categories).