09 — Canonical Data Model
Principles
- Normalized relational model.
- SQLite initially.
- Paths are attributes, not permanent identity.
- Historical scans and actions are retained.
- Provider-specific details may be stored in extension tables/structured metadata only when normalization would add no value.
- Core business entities should not be reduced to opaque JSON blobs.
Core Entities
volume
Represents a mounted physical/logical volume.
Key fields:
volume_idUUIDstable_identifiernamemount_pathfilesystem_typeis_internalis_removablecapacity_bytesavailable_bytesfirst_seen_atlast_seen_at
storage_root
A configured/discovered root.
Fields:
root_idvolume_idprovider_idpathdisplay_namerolescan_enabledcreated_atupdated_at
provider
Normalized provider.
Examples:
- LOCAL
- ICLOUD
- ONEDRIVE
Fields:
provider_idprovider_typeaccount_labeldisplay_name
scan
One inventory execution.
Fields:
scan_idstarted_atcompleted_atstatusfiles_seendirectories_seenlogical_bytes_seenerror_count
scan_root
Tracks coverage per root.
Fields:
scan_root_idscan_idroot_idstatusstarted_atcompleted_aterror_count
file_item
Current known file/directory identity.
Fields:
file_idvolume_idfilesystem_identitycurrent_pathparent_pathnameextensioncontent_typeis_directoryis_symlinkis_packageis_hiddenlogical_size_bytesallocated_size_bytescreated_at_fsmodified_at_fsaccessed_at_fsprovider_idcloud_statefirst_seen_atlast_seen_atexists_last_scan
file_observation
Optional historical observation per scan for attributes that changed.
Fields:
observation_idscan_idfile_idpathlogical_size_bytesallocated_size_bytesmodified_at_fscloud_stateobserved_at
file_hash
Fields:
file_hash_idfile_idalgorithmhash_type(PARTIAL,FULL)digestcalculated_atcontent_version_evidencestatus
Unique constraint should prevent duplicate equivalent hash records.
duplicate_group
Fields:
duplicate_group_idduplicate_typealgorithmdigestlogical_size_bytescreated_atlast_evaluated_at
duplicate_member
Fields:
duplicate_group_idfile_idconfidenceis_exact
collection
Logical protection grouping.
Fields:
collection_idnamedescriptionfreshness_threshold_dayscreated_at
collection_root
Many-to-many mapping between collections and roots.
recommendation
Fields:
recommendation_idfile_idorduplicate_group_idrecommendation_typereason_codereason_textconfidenceestimated_reclaimable_bytescreated_atstatus
activity
Immutable-ish operational/audit log.
Fields:
activity_idactivity_typestarted_atcompleted_atstatussummaryerror_text
Future Backup Entities
backup_job
backup_job_idnameenableddestination_root_idverification_policyfreshness_threshold_days
backup_job_source
Maps job to collection/root.
backup_run
backup_run_idbackup_job_id- timestamps/status/counts/bytes
backup_copy
Maps source file/version to destination and verification.
Future Archive Entities
archive_operation
Tracks transaction.
archive_item
Records original path, archive path, hashes, verification, source cleanup state.
Relationships
volume 1 ── * storage_root
provider 1 ── * storage_root
volume 1 ── * file_item
provider 1 ── * file_item
scan 1 ── * scan_root
scan 1 ── * file_observation
file_item 1 ── * file_hash
duplicate_group * ── * file_item (via duplicate_member)
collection * ── * storage_root (via collection_root)
Migration Policy
Schema changes must use ordered migrations committed to source control. Never mutate a production catalog schema ad hoc.