Start to explain the Core Data based structures.
@@ -18,6 +18,15 @@ The primary tables of concern are:
|
||||
|ZINTERNALRESOURCE|Appears to be information on every internal resource used by Photos; used by osxphotos to find which photos are available locally or in iCloud|
|
||||
|ZCLOUDMASTER|Information about photos in iCloud; used to determine which photos have been synched to the cloud|
|
||||
|ZUNIFORMTYPEIDENTIFIER|Used to determine the UTI (file type) for photos in the library|
|
||||
|Z_PRIMARYKEY|Defines the Core Data entity types in use by the Photos libary|
|
||||
|
||||
## Core Data
|
||||
|
||||
Under the hood, Photos.app uses [Core Data](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/index.html) to mediate access to the Photos library which is the source of the `Z` prefix on table and column names. Of particular note is the `Z_PRIMARYKEY` table which defines all the entities of the data model. Every record has an entity id `Z_ENT`, name `Z_NAME`, parent entity `Z_SUPER`, and its max record ID `Z_MAX`. Each root entity (`Z_SUPER = 0`) has a corresponding sqlite table named `Z${Z_NAME}` which contains all the records for itself and any child entities. For example, the `ZGENERICALBUM` table contains all the 'Album', 'Folder', 'ImportSession', etc records.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
<a name="assets-join-table">1</a>: This may actually be a dynamically named table of the from `Z_##ASSETS` as suggested by [this post](https://www.forensicmike1.com/2019/05/02/ios-photos-sqlite-forensics/) which has it as `Z_23ASSETS`. Suspect that this may be derived from a type identifier since albums can have a "super class" and this would be a reference to the an album id.
|
||||
<a name="assets-join-table">1</a>: This is actually a dynamically named table of the form `Z_##ASSETS`. The ## is the `Z_ENT` value for the record with `Z_NAME = 'Album'` from the `Z_PRIMARYKEY` table. It always appears to be 26 for the macOS Photos library but in [this post](https://www.forensicmike1.com/2019/05/02/ios-photos-sqlite-forensics/) it is `Z_23ASSETS` for an iOS Photos library.
|
||||
Reference in New Issue
Block a user