import_legacy_filesystem_data

Function import_legacy_filesystem_data 

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

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:

  • Database mode: had .metadata.json keyed by fingerprint.
  • Filesystem mode: no .metadata.json; only .reading-states/ files. Stub book rows are inserted to satisfy the foreign key before reading states are written. A follow-up migration prunes stubs for missing files.

The migration is idempotent (all inserts use ON CONFLICT … DO NOTHING).

Migration ID: v1_import_legacy_filesystem_data

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

DELETE FROM _cadmus_migrations WHERE id = 'v1_import_legacy_filesystem_data';