Getǣl — Read-only macOS home directory disk usage cartography & APFS telemetry service

Normalize SQLite paths with integer dir_id/parent_id and drop redundant indexes #8

Merged zip.mu.social
targeting dev from fix/sqlite-schema-normalization
Merged opened by zip.mu.social
targeting dev from fix/sqlite-schema-normalization

Resolves #4.

  • Added id INTEGER PRIMARY KEY and parent_id INTEGER to directories (removing parent_path TEXT and deriving DirectoryRecord::parent_path from path), indexed by idx_directories_parent_id(parent_id).
  • Dropped idx_directories_depth(depth, path) and switched load_subtree_up_to_depth to a WITH RECURSIVE CTE over idx_directories_parent_id.
  • Replaced idx_directories_name with partial index idx_directories_bloat covering only the 8 bloat directory names.
  • Normalized top_files onto (id INTEGER PRIMARY KEY, dir_id INTEGER NOT NULL, name TEXT NOT NULL, ..., category INTEGER NOT NULL, UNIQUE(dir_id, name)), removing duplicated path, dir_path, and idx_top_files_dir, and bumped SCHEMA_VERSION to "3".
  • Added FileCategory::from_u8 (src/domain/mod.rs) and schema_v3_normalizes_paths_and_drops_redundant_indexes (src/cache/mod.rs).

Verified: cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, and cargo test (31 unit + 2 e2e) all pass.

Commits 1

Normalize SQLite paths with integer dir_id/parent_id and drop redundant indexes
Sign up or Sign in to add to the discussion.