Upgrading Confluence fails due to conflict with FOREIGN KEY constraint 'fk_ao_9412a1_user_app_link_user_id' error
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
問題
Upgrading Confluence fails with an error related to a foreign key constraint
The following appears in the atlassian-confluence.log
2016-04-27 08:26:13,463 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.MsSqlServerAoUpgradeTask@1b240eb1 failed during the SCHEMA_UPGRADE phase due to: StatementCallback; SQL [ALTER TABLE AO_9412A1_USER_APP_LINK ADD CONSTRAINT fk_ao_9412a1_user_app_link_user_id FOREIGN KEY (USER_ID) references AO_9412A1_AOUSER(ID);]; The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_ao_9412a1_user_app_link_user_id". The conflict occurred in database "WikiTEST", table "dbo.AO_9412A1_AOUSER", column 'ID'.; nested exception is java.sql.SQLException: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_ao_9412a1_user_app_link_user_id". The conflict occurred in database "WikiTEST", table "dbo.AO_9412A1_AOUSER", column 'ID'
原因
The conflict occurs because the constraint already exists in the database.
回避策
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。
- Rollback Confluence to pre-upgraded state.
- Back up the database.
Drop the foreign key constraint fk_ao_9412a1_user_app_link_user_id. The following query is for MySQL, please modify for any changes with the database being used.
ALTER TABLE AO_9412A1_USER_APP_LINK DROP CONSTRAINT fk_ao_9412a1_user_app_link_user_id;
- Upgrade Confluence.