Upgrade Fails Due to Foreign Key Constraint in the PAGETEMPLATES Table
症状
Upgrade fails. The following appears in the atlassian-confluence.log
:
Cannot add or update a child row: a foreign key constraint fails (`confluencedb/#sql-214_69ba`, CONSTRAINT `FKBC7CE96A17D4A070` FOREIGN KEY (`PREVVER`) REFERENCES `pagetemplates` (`TEMPLATEID`))
原因
It means there is a row in the PAGETEMPLATES
table where its prevver
column does not exist in the templateid
column. This is a constraint violation.
ソリューション
データベースを変更する前には必ずデータをバックアップするようにします。
Roll back database to the previous state (before upgrade)
Search for the rogue row by running:
select * from pagetemplates where prevver not in (select templateid from pagetemplates);
Delete it after making a backup of your database:
delete from pagetemplates where templateid is in (select templateid from pagetemplates where prevver not in (select templateid from pagetemplates));
If you are using MySQL, the delete command above will fail. The work around is to delete the problematic template one by one:
delete from pagetemplates where templateid = <template_id>;
<template_id> is the value for templateid returned from the select query.
- Re-run the upgrade
最終更新日 2018 年 11 月 14 日
Powered by Confluence and Scroll Viewport.