Shotwell not copying when importing

I use Shotwell for managing my photos and generally it works really well as a replacement for f-spot on my Ubuntu system. My work flow is to put photos in a folder ready to import, import them into Shotwell, and then empty the folder. I discovered very early on that it is important to copy photos rather than accept the default of linking to them otherwise they disappear from Shotwell after the input folder is cleared.

Unfortunately, after an upgrade, Shotwell stopped presenting the option of copy vs link and I imported anyway. Big mistake ;-). It seems to be important to locate the input folder (if using a work flow of add to input->import->clear input) outside of the folder Shotwell is storing its Photos under. E.g. if Shotwell is putting its images under ~/Pictures then don’t have your input folder anywhere like ~/Pictures/images to import.

Fixing the problem was a bit complicated because deleting the imported photos from Shotwell, relocating the input folder so it was outside the Shotwell storage path, and reimporting the images didn’t actually copy them even when the copy option was selected. It seems that Shotwell treats the image as already having been imported and so only does a link. Looking at the source code (yay for open source) gave some useful hints about how Shotwell was actually working esp

The solution was to delete all records from the PhotoTable table in ~/.local/share/shotwell/data/photo.db Sqlite database where the filename field started with the poorly-located input folder. Obviously I copied the database file first ;-). E.g.

DELETE FROM PhotoTable WHERE filename LIKE '/home/username/Pictures/0 images to import/%'

Reimporting worked as it should have after this step. “DB Browser for SQLite” is brilliant, BTW.