(mysql)从 digikam 4.* 迁移到 5.* 时数据库迁移困难

(mysql)Database migration difficulty when migrating from digikam 4.* to 5.*

我有!用 digikam 和我的 debian stable/testing mix 管理了十年价值的标记照片最近升级到 digikam 5.*.

我现在面临的问题是,在尝试升级到较新的数据库方案 (v.8) 时,(mysql) 持有爱的劳动的数据库似乎出现了问题。

当启动 digikam v5.* 指向 4.*-used 数据库后端时,我得到以下信息:

digikam.dbengine: Loading SQL code from config file "/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  7
digikam.coredb: Core database: makeUpdates  7  to  8
digikam.dbengine: Failure executing query:
 ""
Error messages: "QMYSQL: Unable to execute query" "Can't DROP 'Albums_AlbumRoots'; check that column/key exists" 1091 2
Bound values:  ()
digikam.dbengine: Error while executing DBAction [ "UpdateSchemaFromV7ToV8" ] Statement [ "ALTER TABLE Albums\n                                        DROP FOREIGN KEY Albums_AlbumRoots;" ]
digikam.coredb: Core database: schema update to V 8 failed!
digikam.coredb: Core database: cannot process schema initialization

当明确尝试使用 5.* 中包含的数据库迁移工具时,我最终遇到了下图所示的错误:

任何人都可以帮助破译这里发生的事情,分别如何修复它?

约翰

由于旧数据库中的一些不一致,我遇到了同样的问题。在修复这些(主要是删除一些死引用)之后,升级就完成了。我似乎还有另一个问题,但可能与数据库无关。

这将显示您的问题(除根标签外都应为空):

取自https://bugs.kde.org/show_bug.cgi?id=355831#c73

select * from Images where album not in (select Albums.id from Albums);
select id, icon from Albums where icon != 0 and icon not in (select id from Images);
select * from Albums where Albums.albumRoot not in (select AlbumRoots.id from AlbumRoots);
select * from ImageHaarMatrix where imageid not in (select id from Images);
select * from ImageInformation where imageid not in (select id from Images);
select * from ImageMetadata where imageid not in (select id from Images);
select * from VideoMetadata where imageid not in (select id from Images);
select * from ImagePositions where imageid not in (select id from Images);
select * from ImageComments where imageid not in (select id from Images);
select * from ImageCopyright where imageid not in (select id from Images);
select * from Tags where pid != 0 and pid not in (select id from Tags);
select id, icon from Tags where icon != 0 and icon not in (select id from Images);
select * from ImageTags where tagid not in (select id from Tags);
select * from ImageTags where imageid not in (select id from Images);
select * from ImageProperties where imageid not in (select id from Images);
select * from ImageHistory where imageid not in (select id from Images);
select * from ImageRelations where subject not in (select id from Images);
select * from ImageRelations where object not in (select id from Images);
select * from ImageTagProperties where imageid not in (select id from Images);
select * from TagProperties where tagid not in (select id from Tags);
select * from ImageTagProperties where tagid not in (select id from Tags);

源头还有修复脚本可以找

而且我刚刚得知,5.2.0 已经在前两天发布了!

(很难从 Debian Wheezy 迁移到 Debian Stretch,希望这对某人有所帮助...)

这对我有用:

  • 确保 digiKam 不是 运行

  • 将您的旧配置文件从 ~/.kde/share/config/digikamrc 复制到 ~/.config/digikamrc

  • 使用一些 sqlite 编辑器(例如 sqlitebrowser)打开您的 digikam4.db 数据库文件

  • 编辑 table AlbumRoots 并修复 identifier 列中的斜杠(即替换所有 %2F/)

    UPDATE AlbumRoots
    SET identifier = replace(identifier, '%2F', '/')
    WHERE identifier LIKE '%%%2F%';
    
  • 保存数据库

  • 双手合十(可选,但推荐)

  • 启动 digiKam

祝你好运!