diff --git a/Understanding-the-Photos-database.md b/Understanding-the-Photos-database.md index 3505b9b..1b169da 100644 --- a/Understanding-the-Photos-database.md +++ b/Understanding-the-Photos-database.md @@ -17,3 +17,18 @@ In Photos 5.0, this file also exists but contains only metadata data about the l ~/Pictures/Photos Library.photoslibrary/database/Photos.sqlite +osxphotos reads `photos.db` (which is present in all versions of Photos) then reads `Photos.sqlite` if the library is a Photos 5 library. + +To read the library version, osxphotos PhotosDB calls `self._get_db_version()` which queries `photos.db` using the following sql statement to find the library version: + + SELECT value from LiGlobals where LiGlobals.keyPath is 'libraryVersion' + +The version is a 4-digit integer, the first digit of which signifies which version of Photos created the library. The versions I've been able to determine from testing are: + +* Photos 2.0 (10.12.6) == 2622 +* Photos 3.0 (10.13.6) == 3301 +* Photos 4.0 (10.14.5) == 4016 +* Photos 4.0 (10.14.6) == 4025 +* Photos 5.0 (10.15.0) == 6000 + +