diff --git a/digikam-5.8.0.fix-db-migration-0001.patch b/digikam-5.8.0.fix-db-migration-0001.patch new file mode 100644 index 0000000..b97d18c --- /dev/null +++ b/digikam-5.8.0.fix-db-migration-0001.patch @@ -0,0 +1,236 @@ +From 5893fde69518d70904d2b96e13800c7432b4e4c4 Mon Sep 17 00:00:00 2001 +From: Maik Qualmann +Date: Mon, 15 Jan 2018 20:24:41 +0100 +Subject: fix schema update from V7/8 to V9 with temporary tables BUGS: 388977 + BUGS: 388867 BUGS: 388824 FIXED-IN: 5.9.0 + +--- + data/database/dbconfig.xml.cmake.in | 154 +++++++++++++++++++++++++++++------- + 2 files changed, 124 insertions(+), 30 deletions(-) + +diff --git a/data/database/dbconfig.xml.cmake.in b/data/database/dbconfig.xml.cmake.in +index a315361..2c5008f 100644 +--- a/data/database/dbconfig.xml.cmake.in ++++ b/data/database/dbconfig.xml.cmake.in +@@ -1992,8 +1992,6 @@ + END IF; + END; + +- SET SESSION OLD_ALTER_TABLE=1; +- SET SESSION FOREIGN_KEY_CHECKS=0; + DROP TRIGGER IF EXISTS delete_image; + DROP TRIGGER IF EXISTS delete_tag; + DROP TRIGGER IF EXISTS move_tagstree; +@@ -2064,85 +2062,181 @@ + ALTER TABLE TagProperties MODIFY COLUMN value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ALTER TABLE ImageTagProperties MODIFY COLUMN property TEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ALTER TABLE ImageTagProperties MODIFY COLUMN value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; +- ALTER IGNORE TABLE AlbumRoots ++ ++ RENAME TABLE AlbumRoots TO AlbumRoots_old; ++ CREATE TABLE AlbumRoots LIKE AlbumRoots_old; ++ ALTER TABLE AlbumRoots + ADD UNIQUE (identifier(127), specificPath(128)), + ENGINE InnoDB; +- ALTER IGNORE TABLE Albums ++ INSERT IGNORE INTO AlbumRoots SELECT * FROM AlbumRoots_old; ++ ++ RENAME TABLE Albums TO Albums_old; ++ CREATE TABLE Albums LIKE Albums_old; ++ ALTER TABLE Albums + ADD CONSTRAINT Albums_AlbumRoots FOREIGN KEY (albumRoot) REFERENCES AlbumRoots (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD UNIQUE (albumRoot, relativePath(255)), + ENGINE InnoDB; +- ALTER IGNORE TABLE Images ++ INSERT IGNORE INTO Albums SELECT * FROM Albums_old; ++ UPDATE Albums SET icon = NULL WHERE icon = 0; ++ ++ RENAME TABLE Images TO Images_old; ++ CREATE TABLE Images LIKE Images_old; ++ ALTER TABLE Images + ADD CONSTRAINT Images_Albums FOREIGN KEY (album) REFERENCES Albums (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD UNIQUE (album, name(255)), + ENGINE InnoDB; +- UPDATE Albums SET icon = NULL WHERE icon = 0; +- ALTER IGNORE TABLE Albums ++ INSERT IGNORE INTO Images SELECT * FROM Images_old; ++ ++ ALTER TABLE Albums + ADD CONSTRAINT Albums_Images FOREIGN KEY (icon) REFERENCES Images (id) ON DELETE SET NULL ON UPDATE CASCADE; +- ALTER IGNORE TABLE ImageHaarMatrix ++ ++ RENAME TABLE ImageHaarMatrix TO ImageHaarMatrix_old; ++ CREATE TABLE ImageHaarMatrix LIKE ImageHaarMatrix_old; ++ ALTER TABLE ImageHaarMatrix + ADD CONSTRAINT ImageHaarMatrix_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageInformation ++ INSERT IGNORE INTO ImageHaarMatrix SELECT * FROM ImageHaarMatrix_old; ++ ++ RENAME TABLE ImageInformation TO ImageInformation_old; ++ CREATE TABLE ImageInformation LIKE ImageInformation_old; ++ ALTER TABLE ImageInformation + ADD CONSTRAINT ImageInformation_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageMetadata ++ INSERT IGNORE INTO ImageInformation SELECT * FROM ImageInformation_old; ++ ++ RENAME TABLE ImageMetadata TO ImageMetadata_old; ++ CREATE TABLE ImageMetadata LIKE ImageMetadata_old; ++ ALTER TABLE ImageMetadata + ADD CONSTRAINT ImageMetadata_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE VideoMetadata ++ INSERT IGNORE INTO ImageMetadata SELECT * FROM ImageMetadata_old; ++ ++ RENAME TABLE VideoMetadata TO VideoMetadata_old; ++ CREATE TABLE VideoMetadata LIKE VideoMetadata_old; ++ ALTER TABLE VideoMetadata + ADD CONSTRAINT VideoMetadata_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImagePositions ++ INSERT IGNORE INTO VideoMetadata SELECT * FROM VideoMetadata_old; ++ ++ RENAME TABLE ImagePositions TO ImagePositions_old; ++ CREATE TABLE ImagePositions LIKE ImagePositions_old; ++ ALTER TABLE ImagePositions + ADD CONSTRAINT ImagePositions_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageComments ++ INSERT IGNORE INTO ImagePositions SELECT * FROM ImagePositions_old; ++ ++ RENAME TABLE ImageComments TO ImageComments_old; ++ CREATE TABLE ImageComments LIKE ImageComments_old; ++ ALTER TABLE ImageComments + ADD CONSTRAINT ImageComments_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD UNIQUE(imageid, type, language, author(202)), + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageCopyright ++ INSERT IGNORE INTO ImageComments SELECT * FROM ImageComments_old; ++ ++ RENAME TABLE ImageCopyright TO ImageCopyright_old; ++ CREATE TABLE ImageCopyright LIKE ImageCopyright_old; ++ ALTER TABLE ImageCopyright + ADD CONSTRAINT ImageCopyright_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD UNIQUE(imageid, property(110), value(111), extraValue(111)), + ENGINE InnoDB; ++ INSERT IGNORE INTO ImageCopyright SELECT * FROM ImageCopyright_old; ++ ++ RENAME TABLE Tags TO Tags_old; ++ CREATE TABLE Tags LIKE Tags_old; ++ ALTER TABLE Tags ++ ADD CONSTRAINT Tags_Images FOREIGN KEY (icon) REFERENCES Images (id) ON DELETE SET NULL ON UPDATE CASCADE, ++ ADD UNIQUE(pid, name(100)), ++ ENGINE InnoDB; ++ INSERT IGNORE INTO Tags SELECT * FROM Tags_old; + SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'; + REPLACE INTO Tags (id, pid, name, icon, iconkde, lft, rgt) VALUES (0, -1, '_Digikam_root_tag_', NULL, NULL, + (SELECT MIN(tl.lft) FROM Tags AS tl), + (SELECT MAX(tr.rgt) FROM Tags AS tr)); + SET SQL_MODE=@OLD_SQL_MODE; +- UPDATE Tags set icon = NULL WHERE icon = 0; +- ALTER IGNORE TABLE Tags +- ADD CONSTRAINT Tags_Images FOREIGN KEY (icon) REFERENCES Images (id) ON DELETE SET NULL ON UPDATE CASCADE, +- ADD UNIQUE(pid, name(100)), +- ENGINE InnoDB; +- ALTER IGNORE TABLE ImageTags ++ UPDATE Tags SET icon = NULL WHERE icon = 0; ++ ++ RENAME TABLE ImageTags TO ImageTags_old; ++ CREATE TABLE ImageTags LIKE ImageTags_old; ++ ALTER TABLE ImageTags + ADD CONSTRAINT ImageTags_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT ImageTags_Tags FOREIGN KEY (tagid) REFERENCES Tags (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageProperties ++ INSERT IGNORE INTO ImageTags SELECT * FROM ImageTags_old; ++ ++ RENAME TABLE ImageProperties TO ImageProperties_old; ++ CREATE TABLE ImageProperties LIKE ImageProperties_old; ++ ALTER TABLE ImageProperties + ADD CONSTRAINT ImageProperties_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD UNIQUE (imageid, property(255)), + ENGINE InnoDB; +- ALTER IGNORE TABLE Searches ++ INSERT IGNORE INTO ImageProperties SELECT * FROM ImageProperties_old; ++ ++ ALTER TABLE Searches + ENGINE InnoDB; +- ALTER IGNORE TABLE DownloadHistory ++ ++ RENAME TABLE DownloadHistory TO DownloadHistory_old; ++ CREATE TABLE DownloadHistory LIKE DownloadHistory_old; ++ ALTER TABLE DownloadHistory + ADD UNIQUE(identifier(164), filename(165), filesize, filedate), + ENGINE InnoDB; +- ALTER IGNORE TABLE Settings ++ INSERT IGNORE INTO DownloadHistory SELECT * FROM DownloadHistory_old; ++ ++ RENAME TABLE Settings TO Settings_old; ++ CREATE TABLE Settings LIKE Settings_old; ++ ALTER TABLE Settings + ADD UNIQUE(keyword(255)), + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageHistory ++ INSERT IGNORE INTO Settings SELECT * FROM Settings_old; ++ ++ RENAME TABLE ImageHistory TO ImageHistory_old; ++ CREATE TABLE ImageHistory LIKE ImageHistory_old; ++ ALTER TABLE ImageHistory + ADD CONSTRAINT ImageHistory_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageRelations ++ INSERT IGNORE INTO ImageHistory SELECT * FROM ImageHistory_old; ++ ++ RENAME TABLE ImageRelations TO ImageRelations_old; ++ CREATE TABLE ImageRelations LIKE ImageRelations_old; ++ ALTER TABLE ImageRelations + ADD CONSTRAINT ImageRelations_ImagesS FOREIGN KEY (subject) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT ImageRelations_ImagesO FOREIGN KEY (object) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE TagProperties ++ INSERT IGNORE INTO ImageRelations SELECT * FROM ImageRelations_old; ++ ++ RENAME TABLE TagProperties TO TagProperties_old; ++ CREATE TABLE TagProperties LIKE TagProperties_old; ++ ALTER TABLE TagProperties + ADD CONSTRAINT TagProperties_Tags FOREIGN KEY (tagid) REFERENCES Tags (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- ALTER IGNORE TABLE ImageTagProperties ++ INSERT IGNORE INTO TagProperties SELECT * FROM TagProperties_old; ++ ++ RENAME TABLE ImageTagProperties TO ImageTagProperties_old; ++ CREATE TABLE ImageTagProperties LIKE ImageTagProperties_old; ++ ALTER TABLE ImageTagProperties + ADD CONSTRAINT ImageTagProperties_Images FOREIGN KEY (imageid) REFERENCES Images (id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT ImageTagProperties_Tags FOREIGN KEY (tagid) REFERENCES Tags (id) ON DELETE CASCADE ON UPDATE CASCADE, + ENGINE InnoDB; +- SET SESSION FOREIGN_KEY_CHECKS=1; +- SET SESSION OLD_ALTER_TABLE=0; ++ INSERT IGNORE INTO ImageTagProperties SELECT * FROM ImageTagProperties_old; ++ ++ DROP TABLE ImageTagProperties_old; ++ DROP TABLE TagProperties_old; ++ DROP TABLE ImageRelations_old; ++ DROP TABLE ImageHistory_old; ++ DROP TABLE Settings_old; ++ DROP TABLE DownloadHistory_old; ++ DROP TABLE ImageProperties_old; ++ DROP TABLE ImageTags_old; ++ DROP TABLE Tags_old; ++ DROP TABLE ImageCopyright_old; ++ DROP TABLE ImageComments_old; ++ DROP TABLE ImagePositions_old; ++ DROP TABLE VideoMetadata_old; ++ DROP TABLE ImageMetadata_old; ++ DROP TABLE ImageInformation_old; ++ DROP TABLE ImageHaarMatrix_old; ++ DROP TABLE Images_old; ++ DROP TABLE Albums_old; ++ DROP TABLE AlbumRoots_old; + + + +-- +cgit v0.11.2 + diff --git a/digikam-5.8.0.fix-db-migration-0002.patch b/digikam-5.8.0.fix-db-migration-0002.patch new file mode 100644 index 0000000..276068e --- /dev/null +++ b/digikam-5.8.0.fix-db-migration-0002.patch @@ -0,0 +1,25 @@ +From 6c8398db5c57a550e7b14f48a0701b28f0eca840 Mon Sep 17 00:00:00 2001 +From: Maik Qualmann +Date: Mon, 15 Jan 2018 22:57:11 +0100 +Subject: small fix for the schema update + +--- + data/database/dbconfig.xml.cmake.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/database/dbconfig.xml.cmake.in b/data/database/dbconfig.xml.cmake.in +index 2c5008f..a1cd69f 100644 +--- a/data/database/dbconfig.xml.cmake.in ++++ b/data/database/dbconfig.xml.cmake.in +@@ -2147,7 +2147,7 @@ + ADD CONSTRAINT Tags_Images FOREIGN KEY (icon) REFERENCES Images (id) ON DELETE SET NULL ON UPDATE CASCADE, + ADD UNIQUE(pid, name(100)), + ENGINE InnoDB; +- INSERT IGNORE INTO Tags SELECT * FROM Tags_old; ++ REPLACE INTO Tags SELECT * FROM Tags_old; + SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'; + REPLACE INTO Tags (id, pid, name, icon, iconkde, lft, rgt) VALUES (0, -1, '_Digikam_root_tag_', NULL, NULL, + (SELECT MIN(tl.lft) FROM Tags AS tl), +-- +cgit v0.11.2 + diff --git a/digikam-5.8.0.fix-db-migration-0003.patch b/digikam-5.8.0.fix-db-migration-0003.patch new file mode 100644 index 0000000..c25366c --- /dev/null +++ b/digikam-5.8.0.fix-db-migration-0003.patch @@ -0,0 +1,33 @@ +From 443ce0e848a0da4fa7c80dd5b077fb6b8a545126 Mon Sep 17 00:00:00 2001 +From: Maik Qualmann +Date: Fri, 19 Jan 2018 07:07:08 +0100 +Subject: disable foreign key checks temporarily for the Tags table BUGS: + 388824 + +--- + data/database/dbconfig.xml.cmake.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/data/database/dbconfig.xml.cmake.in b/data/database/dbconfig.xml.cmake.in +index a1cd69f..a98434b 100644 +--- a/data/database/dbconfig.xml.cmake.in ++++ b/data/database/dbconfig.xml.cmake.in +@@ -2141,6 +2141,7 @@ + ENGINE InnoDB; + INSERT IGNORE INTO ImageCopyright SELECT * FROM ImageCopyright_old; + ++ SET FOREIGN_KEY_CHECKS=0; + RENAME TABLE Tags TO Tags_old; + CREATE TABLE Tags LIKE Tags_old; + ALTER TABLE Tags +@@ -2154,6 +2155,7 @@ + (SELECT MAX(tr.rgt) FROM Tags AS tr)); + SET SQL_MODE=@OLD_SQL_MODE; + UPDATE Tags SET icon = NULL WHERE icon = 0; ++ SET FOREIGN_KEY_CHECKS=1; + + RENAME TABLE ImageTags TO ImageTags_old; + CREATE TABLE ImageTags LIKE ImageTags_old; +-- +cgit v0.11.2 + diff --git a/digikam-5.8.0.fix-db-migration-0004.patch b/digikam-5.8.0.fix-db-migration-0004.patch new file mode 100644 index 0000000..c040b32 --- /dev/null +++ b/digikam-5.8.0.fix-db-migration-0004.patch @@ -0,0 +1,51 @@ +From ceb41a7f89ddf9716507466861828925357ab3f3 Mon Sep 17 00:00:00 2001 +From: Maik Qualmann +Date: Fri, 19 Jan 2018 19:59:44 +0100 +Subject: drop old table if new run required + +--- + data/database/dbconfig.xml.cmake.in | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/data/database/dbconfig.xml.cmake.in b/data/database/dbconfig.xml.cmake.in +index a98434b..3ec790f 100644 +--- a/data/database/dbconfig.xml.cmake.in ++++ b/data/database/dbconfig.xml.cmake.in +@@ -2024,6 +2024,7 @@ + CALL drop_foreign_key('TagProperties', 'TagProperties_Tags'); + CALL drop_foreign_key('ImageTagProperties', 'ImageTagProperties_Images'); + CALL drop_foreign_key('ImageTagProperties', 'ImageTagProperties_Tags'); ++ + ALTER TABLE AlbumRoots MODIFY COLUMN label LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ALTER TABLE AlbumRoots MODIFY COLUMN identifier LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ALTER TABLE AlbumRoots MODIFY COLUMN specificPath LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; +@@ -2063,6 +2064,26 @@ + ALTER TABLE ImageTagProperties MODIFY COLUMN property TEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ALTER TABLE ImageTagProperties MODIFY COLUMN value LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci; + ++ DROP TABLE IF EXISTS ImageTagProperties_old; ++ DROP TABLE IF EXISTS TagProperties_old; ++ DROP TABLE IF EXISTS ImageRelations_old; ++ DROP TABLE IF EXISTS ImageHistory_old; ++ DROP TABLE IF EXISTS Settings_old; ++ DROP TABLE IF EXISTS DownloadHistory_old; ++ DROP TABLE IF EXISTS ImageProperties_old; ++ DROP TABLE IF EXISTS ImageTags_old; ++ DROP TABLE IF EXISTS Tags_old; ++ DROP TABLE IF EXISTS ImageCopyright_old; ++ DROP TABLE IF EXISTS ImageComments_old; ++ DROP TABLE IF EXISTS ImagePositions_old; ++ DROP TABLE IF EXISTS VideoMetadata_old; ++ DROP TABLE IF EXISTS ImageMetadata_old; ++ DROP TABLE IF EXISTS ImageInformation_old; ++ DROP TABLE IF EXISTS ImageHaarMatrix_old; ++ DROP TABLE IF EXISTS Images_old; ++ DROP TABLE IF EXISTS Albums_old; ++ DROP TABLE IF EXISTS AlbumRoots_old; ++ + RENAME TABLE AlbumRoots TO AlbumRoots_old; + CREATE TABLE AlbumRoots LIKE AlbumRoots_old; + ALTER TABLE AlbumRoots +-- +cgit v0.11.2 + diff --git a/digikam.changes b/digikam.changes index 032022e..26d682b 100644 --- a/digikam.changes +++ b/digikam.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Jan 18 23:17:51 UTC 2018 - nico.kruber@gmail.com + +- Add digikam-5.8.0.fix-db-migration-0001.patch (adapted to 5.8.0), + digikam-5.8.0.fix-db-migration-0002.patch, + digikam-5.8.0.fix-db-migration-0003.patch, and + digikam-5.8.0.fix-db-migration-0004.patch to fix MySQL DB + migration issues (kde#388824, kde#388867, kde#388977) + ------------------------------------------------------------------- Wed Jan 17 18:50:08 UTC 2018 - wbauer@tmo.at diff --git a/digikam.spec b/digikam.spec index 9128ef8..744c1d5 100644 --- a/digikam.spec +++ b/digikam.spec @@ -34,6 +34,14 @@ Patch2: 0002-Revert-replace-obsolete-qSort-function.patch Patch3: fix-italian-docs-with-older-kdoctools.patch # PATCH-FIX-UPSTREAM Patch4: fix-font-size-in-tooltips.patch +# PATCH-FIX-UPSTREAM digikam-5.8.0.fix-db-migration-0001.patch -- fix MySQL DB migration issues (kde#388824, kde#388867, kde#388977) +Patch5: digikam-5.8.0.fix-db-migration-0001.patch +# PATCH-FIX-UPSTREAM +Patch6: digikam-5.8.0.fix-db-migration-0002.patch +# PATCH-FIX-UPSTREAM +Patch7: digikam-5.8.0.fix-db-migration-0003.patch +# PATCH-FIX-UPSTREAM +Patch8: digikam-5.8.0.fix-db-migration-0004.patch #This pulls in QWebEngine, which is not available on ppc64 %ifarch %ix86 x86_64 %arm aarch64 mips mips64 BuildRequires: akonadi-contact-devel @@ -185,6 +193,14 @@ The main digikam libraries that are being shared between showfoto and digikam %endif %patch4 -p1 +# DB migration fixes +cd core +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +cd .. + # Remove build time references so build-compare can do its work FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y') FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')