Bug 388501

Summary: UpdateSchemaFromV8ToV9 fails due to duplicate entry for key albumRoot
Product: [Applications] digikam Reporter: Jyrki Soini <Jyrki.Soini>
Component: Database-SchemaAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 5.8.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In: 5.8.0
Sentry Crash Report:

Description Jyrki Soini 2018-01-03 20:23:03 UTC
~> digikam-5.8.0-20180103T083503-x86-64.appimage 
-- digiKam AppImage Bundle
-- Use 'help' as CLI argument to know all available options
digikam.widgets: Breeze icons ressource file found
digikam.general: AlbumWatch use QFileSystemWatcher
digikam.general: Database Parameters:
   Type:                     "QMYSQL"
   DB Core Name:             "digikam"
   DB Thumbs Name:           "digikam"
   DB Face Name:             "digikam"
   Connect Options:          "UNIX_SOCKET=/run/mysql/mysql.sock"
   Host Name:                "localhost"
   Host port:                3306
   Internal Server:          false
   Internal Server Path:     ""
   Internal Server Serv Cmd: ""
   Internal Server Init Cmd: ""
   Username:                 "digikam"
   Password:                 "XXXXXXXXXXXXXXXXXXXX"

digikam.dbengine: Loading SQL code from config file "/tmp/.mount_digikaAps1jS/usr/share/digikam/database/dbconfig.xml"
digikam.dbengine: Checking XML version ID => expected:  3  found:  3
digikam.coredb: Core database: running schema update
digikam.coredb: Core database: have a structure version  8
digikam.coredb: Core database: makeUpdates  8  to  9
digikam.dbengine: Failure executing query:
 "" 
Error messages: "QMYSQL: Unable to execute query" "Duplicate entry '1-/haat' for key 'albumRoot'" 1062 2 
Bound values:  ()
digikam.dbengine: Error while executing DBAction [ "UpdateSchemaFromV8ToV9" ] Statement [ "ALTER TABLE Albums MODIFY COLUMN relativePath LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;" ]
digikam.coredb: Core database: schema update to V 9 failed!
digikam.coredb: Core database: cannot process schema initialization
KMemoryInfo: Platform identified :  "LINUX"
KMemoryInfo: TotalRam:  16765001728
digikam.general: Allowing a cache size of 200 MB
QThreadStorage: Thread 0x7f4cc2d86680 exited after QThreadStorage 11 destroyed
Comment 1 Maik Qualmann 2018-01-03 21:58:05 UTC
Git commit 817ead8eda7dc68de58bd1c4951f1392f148ba65 by Maik Qualmann.
Committed on 03/01/2018 at 21:56.
Pushed by mqualmann into branch 'master'.

we are making a combined update from V7/8 to V9, removing indexes and foreign keys before

M  +68   -113  data/database/dbconfig.xml.cmake.in
M  +3    -3    libs/database/coredb/coredbschemaupdater.cpp

https://commits.kde.org/digikam/817ead8eda7dc68de58bd1c4951f1392f148ba65
Comment 2 Maik Qualmann 2018-01-03 21:59:17 UTC
Gilles, new AppImage for testing please...

Maik
Comment 3 caulier.gilles 2018-01-04 10:56:50 UTC
Done. New AppImage have been are built this morning with current implementation from git/master...

Gilles
Comment 4 caulier.gilles 2018-01-04 10:58:01 UTC
Jyrki,

For testing, you can download new pre-release 5.8.0 AppImage bundle here :

https://files.kde.org/digikam/

Gilles Caulier
Comment 5 Maik Qualmann 2018-01-04 17:29:05 UTC
*** Bug 388533 has been marked as a duplicate of this bug. ***
Comment 6 Maik Qualmann 2018-01-04 17:39:19 UTC
Git commit e2a9793e27374e96d37737c6506a8f8f5a99ff10 by Maik Qualmann.
Committed on 04/01/2018 at 17:38.
Pushed by mqualmann into branch 'master'.

disable for update V7 to V9 temporarily the foreign key check

M  +2    -0    data/database/dbconfig.xml.cmake.in

https://commits.kde.org/digikam/e2a9793e27374e96d37737c6506a8f8f5a99ff10
Comment 7 Maik Qualmann 2018-01-04 20:10:44 UTC
Git commit 6b767163e6ba14b86e6f27341342b84df473f07c by Maik Qualmann.
Committed on 04/01/2018 at 20:08.
Pushed by mqualmann into branch 'master'.

remove double entries with ALTER IGNORE TABLE statement
Related: bug 388467
FIXED-IN: 5.8.0

M  +3    -2    NEWS
M  +23   -21   data/database/dbconfig.xml.cmake.in

https://commits.kde.org/digikam/6b767163e6ba14b86e6f27341342b84df473f07c