Bug 440212

Summary: Digikam 7.3.0 fails to update the database schema from version 12 to version 13
Product: [Applications] digikam Reporter: Martin <martin.ruessler>
Component: Database-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version: 7.3.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 7.4.0
Sentry Crash Report:

Description Martin 2021-07-23 20:34:21 UTC
SUMMARY


STEPS TO REPRODUCE
1. Start digikam (from terminal for the error message)
2. Wait for the error

OBSERVED RESULT

A window with the following text is displayed:
> Failed to update the database schema from version 12 to version 13. Please read the error messages printed on the console and report this error as a bug at bugs.kde.org. 

Terminal output:
> digikam.coredb: Core database: cannot process schema initialization
> QThreadStorage: Thread 0x7f9f18323560 exited after QThreadStorage 13 destroyed

EXPECTED RESULT

Successfull database migration

SOFTWARE/OS VERSIONS
  
Linux/KDE Plasma: Yes!
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2021-07-23 21:02:18 UTC
Current Archlinux MariaDB package is broken. Or you have to upgrade the database because MariaDB has changed the internal structure.

Read these threads:

Bug 440132 - Digikam crashes scanning for new items
Bug 440030 - Database migration 7.2 -> 7.3 fails

https://bugs.archlinux.org/task/71582?project=1&string=mariadb

Maik
Comment 2 Maik Qualmann 2021-07-25 13:45:55 UTC
Git commit 49ee18fbf2220baedbc015f51b74f67930115287 by Maik Qualmann.
Committed on 25/07/2021 at 13:44.
Pushed by mqualmann into branch 'master'.

perform a database upgrade if the server / database version is different
Related: bug 440030
FIXED-IN: 7.4.0

M  +2    -0    NEWS
M  +126  -3    core/libs/database/server/databaseserver.cpp
M  +5    -0    core/libs/database/server/databaseserver.h

https://invent.kde.org/graphics/digikam/commit/49ee18fbf2220baedbc015f51b74f67930115287
Comment 3 Maik Qualmann 2022-01-03 12:25:48 UTC
Yes, you need at least digiKam-7.4.0 to solve the problem. The version reads the MySQL Error Log if the update fails and will start upgrading the database to the new MySQL Server version at the next start.
To understand it, MariaDB has made major changes to the table structure in the database. As long as no changes are made to the database, there is no problem. In the case of a change to the tables, it will fail. For the system MySQL database, a Cron Job is executed which executes the upgrade. In the case of the MYSQL database managed by Digikam, this must either be done manually (not quite simple) or automatically from digiKam-7.4.0 or newer.

Maik