I had some problems with my Apple Photos library and I managed to fix them using this tool I found on the internet. I fixed incorrect metadata on over half of my photos through a handful of simple Terminal commands through this program.
I have been tinkering and it seems you can get extra information and more options backing up your photos with your tool and I had not seen it mentioned here before. I had given up on Apple Photos except for sharing with family and as a backup but this fixed the database.
This is a great way to backup photo libraries as well.
It is not an official program, so it’s probably good to make a backup to an external drive before you use this program. But in my case, there have been no problems.
I have no connection to the creator of this tool.
It is available here: