Bug 286492 - MIGRATION : two SQLITE triggers applied for the same table is not supported by MySQL database
Summary: MIGRATION : two SQLITE triggers applied for the same table is not supported b...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Migration (show other bugs)
Version: 2.3.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-13 14:38 UTC by Ignatius Reilly
Modified: 2017-11-26 06:27 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.8.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ignatius Reilly 2011-11-13 14:38:27 UTC
Version:           2.3.0 (using KDE 4.7.2) 
OS:                Linux

DDL on SQLite:

CREATE TRIGGER delete_tag DELETE ON Tags
                    BEGIN
                        DELETE FROM ImageTags WHERE tagid=OLD.id;
                        DELETE FROM TagProperties WHERE tagid=OLD.id;
                        DELETE FROM ImageTagProperties WHERE tagid=OLD.id;
                    END;
CREATE TRIGGER delete_tagstree DELETE ON Tags
                BEGIN
                DELETE FROM Tags
                WHERE id  IN (SELECT id FROM TagsTree WHERE pid=OLD.id);
                DELETE FROM TagsTree
                WHERE id IN (SELECT id FROM TagsTree WHERE pid=OLD.id);
                DELETE FROM TagsTree
                    WHERE id=OLD.id;
                END;

This is not supported by MySQL

Reproducible: Didn't try

Steps to Reproduce:
Install a new SQLite and export the DDL

Actual Results:  
This possibly impairs the SQLite => MySQL migration

Expected Results:  
Don't know - I upgraded from an older installation

Merge the two triggers into one
Comment 1 Francesco Riosa 2011-12-19 00:30:17 UTC
Actually mysql has only one trigger on `tags` (well it's present two times but it's the same).

Sqlite version of the sql is indeed affected, I don't know how it will react to this.
Comment 2 Francesco Riosa 2011-12-19 00:32:05 UTC
ignitus.reily for your interest mysql code start at 
<database name="QMYSQL">
tag in dbconfig.xml
Comment 3 caulier.gilles 2016-07-06 20:29:51 UTC
Swati,

What about this file ? It still valid ? If yes, the schema must be patched to fix this problem.

Gilles Caulier
Comment 4 Mattia 2016-07-17 08:47:18 UTC
I don't know if I hit the same problem, but I get an error trying to migrate SQLite to an external MySQL database (no details are showed). So, yes, I think this file is still valid.

Additionally, I can't even set up a new empty database, I think for the same problem. Creation and migration both errors out in the middle of the task.

Using Digikam 5.0.0 and MariaDB 5.5.44
Comment 5 caulier.gilles 2016-07-17 09:19:59 UTC
To setup a Mariadb/Mysql database on a remote server, you must follow the requirements listed in DK/Setup/Database tab. It's very important.

Following this rules, i can setup a DB in a Linux host computer and use it in digiKam client from Linux, OSX, or Windows.

The migration is another subject, but it depend of a correct remote DB init.

Gilles Caulier
Comment 6 Mattia 2016-07-17 10:01:39 UTC
(In reply to caulier.gilles from comment #5)
> To setup a Mariadb/Mysql database on a remote server, you must follow the
> requirements listed in DK/Setup/Database tab. It's very important.
> 
> Following this rules, i can setup a DB in a Linux host computer and use it
> in digiKam client from Linux, OSX, or Windows.
> 
> The migration is another subject, but it depend of a correct remote DB init.
> 
> Gilles Caulier

I tried with another server running MariaDB 10.1.14 and it's working. I think MariaDB 5.5.44 running on my Qnap NAS it's just too old...
Comment 7 caulier.gilles 2016-07-27 07:08:34 UTC
Swati,

What about this file ? It still valid ? If yes, the schema must be patched to fix this problem.

Gilles Caulier
Comment 8 Maik Qualmann 2017-11-26 06:27:39 UTC
Git commit 9a17c743ea9a41c1ef050b08517343813ef6a9f4 by Maik Qualmann.
Committed on 25/11/2017 at 22:02.
Pushed by mqualmann into branch 'master'.

update DB to v9 and fix migration from SQLite to MySQL
Related: bug 378838, bug 369083, bug 350574
FIXED-IN: 5.8.0

M  +5    -1    NEWS
M  +129  -97   data/database/dbconfig.xml.cmake.in
M  +1    -1    data/database/mysql-global.conf
M  +1    -20   libs/database/coredb/coredbcopymanager.cpp
M  +5    -2    libs/database/coredb/coredbschemaupdater.cpp

https://commits.kde.org/digikam/9a17c743ea9a41c1ef050b08517343813ef6a9f4