Updated Photos version 5 database (markdown)
@@ -28,6 +28,23 @@ Under the hood, Photos.app uses [Core Data](https://developer.apple.com/library/
|
||||
|
||||
## Albums
|
||||
|
||||
### Album Sort Order
|
||||
In Catalina, the table `Z_26ASSETS` maps albums to photos. It has 3 columns:
|
||||
|
||||
- `Z_26ALBUMS`: foreign key to `ZGENERICALBUM`
|
||||
- `Z_34ASSETS`: foreign key to `ZGENERICASSET`
|
||||
- `Z_FOK_34ASSETS`: while this appears to be a foreign key I think it's actually a sort order (see discussion below)
|
||||
|
||||
If you add photos to an album, the value for `Z_FOK_34ASSETS` for each photos begins at 2048 then increments by 1024 (2^10) for each photo added, e.g. 2048, 3072, 4096, 5120. In the screenshot below, album with `Z_26ALBUMS` = `64` (`ZGENERICALBUM.Z__PK` = 64) has 4 photos added one at a time but not manually sorted:
|
||||
|
||||
<img width="541" alt="Screenshot 2020-07-05 16 42 44" src="https://user-images.githubusercontent.com/41546558/86544809-f1fb0b00-bede-11ea-9afc-f52c2086277b.png">
|
||||
|
||||
In the screenshot below, the last photo (`Z_34ASSETS` = 2) was manually re-ordered to the beginning of the album and has a new value for `Z_FOK_34ASSETS` of 1024 which places it before the previous first photo with value of 2048.
|
||||
|
||||
<img width="522" alt="Screenshot 2020-07-05 16 45 10" src="https://user-images.githubusercontent.com/41546558/86544831-1c4cc880-bedf-11ea-9420-4c93fb43ad5e.png">
|
||||
|
||||
If you change the sort order manually, the value of `Z_FOK_34ASSETS` of the photo(s) you manually moved changes so that if ordered by `Z_FOK_34ASSETS`, the photos will be arranged in the new order.
|
||||
|
||||
**TODO** Document the following
|
||||
|
||||
* [ ] Joining assets
|
||||
|
||||
Reference in New Issue
Block a user