https://bugs.kde.org/show_bug.cgi?id=401811
Bug ID: 401811 Summary: DB migration (SQLite -> MySQL) fails if images are in trash Product: digikam Version: 5.9.0 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: Database-Migration Assignee: digikam-bugs-n...@kde.org Reporter: m...@simon-wuellhorst.de Target Milestone: --- Hi folks, I tried to migrate my digiKam database from SQLite to MySQL. Unfortunately the migration process every time failed during migrating the table "ImageInformation" by displaying the following error message: "Fehler beim Konvertieren der Datenbank. Details: Cannot add or update a child row: a foreign key constraint fails (`digikam core`.`image information`, CONSTRAINT `ImageInformation_Images` FOREIGN KEY (`imageid`) REFERENCES `images` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)" Since the table "Images" is migrated before this error occures I assumed that all images are imported properly to this table. However this assumption was faulty: There are a lot of entries in the SQLite table "images" that are not shown in the migrated MySQL table. By taking a closer look onto the missing entries it turns out all missing Images-entries have been in trash before. After reviewing the involved parts of the source code I was able to determine the reason for this behavior: - When a image is moved to trash the value of album is set to NULL (see: https://cgit.kde.org/digikam.git/tree/libs/database/coredb/coredb.cpp?id=2eaa680e12ab9c033767a8cd47355c4337523a88#n4570 ) - During the migration only images assigned to an existing album are migrated (see: https://cgit.kde.org/digikam.git/tree/data/database/dbconfig.xml.cmake.in?id=2eaa680e12ab9c033767a8cd47355c4337523a88#n622 and https://cgit.kde.org/digikam.git/tree/data/database/dbconfig.xml.cmake.in?id=2eaa680e12ab9c033767a8cd47355c4337523a88#n1684 ) - Since there is no album associated to the id NULL all images located in trash aren't imported. I don't now whether there is any particular reason for filtering out images that are not associated to an album during migration. However reverting the respective commit (see: https://cgit.kde.org/digikam.git/commit/?id=2eaa680e12ab9c033767a8cd47355c4337523a88 ) is fixing the issue. STEPS TO REPRODUCE 1. Move an image to trash. 2. Start DB-migration (e. g. SQLite-> MySQL) 3. Wait until the error message occurs. Greetings, Simon -- You are receiving this mail because: You are watching all bug changes.