1

I've just updated to the new Photos app on OS X and migrated my iPhoto library to the new app. While getting used to all the changes, I've noticed a problem: it seems that the Last Import album is stuck in the iPhoto Events folder for some reason. (Does the iPhoto database consider Last Import to be an "event"?)

I can tell that the lone album is Last Import because:

  • I've moved all other albums out of the folder, but it still says that there is one album left inside, even though the view shows that it is empty inside.

  • When I go back to the top-level album view, the iPhoto Events folder is shown to contain one album thumbnail unlike the inside view. The thumbnail within the folder matches the thumbnail of Last Import.

  • When I move photos out of Last Import and import a different set of photos, both thumbnails update.

Now here's the bigger problem: if I delete the iPhoto Events folder now, I will lose the Last Import album permanently with no apparent way to get it back through the UI or the application's preferences. (I imagine I can get it back by editing either the app's plist in ~/Library/Containers/com.apple.Photos/Data/Library/Preferences or one or more files in the package, but I'm not sure where to look.)

I've tried

  • importing new photos to see if Last Import will reappear, but it doesn't.

  • repairing the Photos library using the same method as iPhoto (hold Command ⌘ and Option ⌥ when opening the app), but it doesn't help.

  • repairing the iPhoto library before migrating to Photos, but it doesn't help either.

  • undoing the deletion, but it just brings back both Last Import and the iPhoto Events folder.

I have re-imported the original iPhoto library for now so that its original state is preserved. What can I do to separate Last Import from the iPhoto Events folder so I can safely remove the latter?

0

1 Answer 1

0

I created a fresh new iPhoto library, populated it with some photos, and migrated that library to Photos, but I could not reproduce this problem. So it looks like another problem with my original iPhoto library. Great.

So I decided to look directly in the Photos library database to see what was going on. The Photos library database can be found in ~/Pictures/Photos Library.photoslibrary/Database/Library.apdb; this is an SQLite database that can be opened using the command-line sqlite3 tool, or any GUI you prefer.

If you're about to follow the steps in my answer past this point, remember to back up the library file before proceeding.

The schema for RKAlbum contains a folderUuid column that associates an album with a folder (in RKFolder). In the Photos library that was migrated from the fresh iPhoto library, the Last Import album looks like this:

sqlite> SELECT name, folderUuid FROM RKAlbum WHERE name = 'Last Import';
Last Import|LibraryFolder

But in the Photos library that was created from my original iPhoto library, the album looks like this:

sqlite> SELECT name, folderUuid FROM RKAlbum WHERE name = 'Last Import';
Last Import|cQeJj7YPRmSxHysWN+ql4w

Notice that folderUuid here is a generated string and not 'LibraryFolder'. Obviously, this is an arbitrary folder — specifically the iPhoto Events folder that is created as part of the migration process. And sure enough:

sqlite> SELECT uuid, name FROM RKFolder WHERE uuid = 'cQeJj7YPRmSxHysWN+ql4w';
cQeJj7YPRmSxHysWN+ql4w|iPhoto Events

As an immediate workaround, changing the column directly seems to work:

sqlite> UPDATE RKAlbum SET folderUuid = 'LibraryFolder' WHERE name = 'Last Import';

Now opening Photos and deleting the iPhoto Events folder leaves Last Import intact. Importing new photos doesn't cause any further problems; the Last Import folder behaves as it always did, and should.


Out of curiosity I decided to find out what was causing Photos to place Last Import in the iPhoto Events folder in the first place.

Turns out, in my original iPhoto library, the folderUuid of Last Import was not 'LibraryFolder', but 'AllProjectsItem' — the same as the original Events category:

sqlite> SELECT name, folderUuid FROM RKAlbum WHERE name = 'Last Import';
Last Import|AllProjectsItem
sqlite> SELECT name, folderUuid FROM RKAlbum WHERE folderUuid = 'AllProjectsItem';
Events|AllProjectsItem
Last Import|AllProjectsItem

This is not the case in the fresh iPhoto library:

sqlite> SELECT name, folderUuid FROM RKAlbum WHERE name = 'Last Import';
Last Import|LibraryFolder

Fixing the incorrect column in the original iPhoto library database (with the same UPDATE statement as above) seems to fix the Last Import folder when migrating to Photos as well. I think I'll go with this instead since it corrects both the old and new libraries.

Like in my previous question, I don't understand why or how my original iPhoto library reached that state in the first place, or why repairing/rebuilding the library didn't help at all. Was I bitten by a rare bug in iPhoto? Was I using iPhoto incorrectly? Either way, I'm lucky that I know a thing or two about SQLite and was therefore able to fix this on my own — if in the unlikely event someone has run into this very same issue, I hope this post will be helpful to them.

Once again, be sure to back up the entire library first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .