'Foreign key has implicit reference to object which does not have a primary key defined on it' error is thrown during Confluence upgrade
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Symptoms
When upgrading, Confluence is inaccessible after startup. An error appears in the logs like:
1
2
3
4
5
6
2010-08-26 15:14:49,975 ERROR [Thread-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema update
java.sql.SQLException: Foreign key 'FK93247246F73AEE0F' has implicit reference to object 'os_user' which does not have a primary key defined on it.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)
Cause
Foreign keys are missing. Atlassian currently believes this is due to a server or database migration in which the SQL dump did not contain foreign keys.
Resolution
From the old instance, take an XML backup.
Create a new, blank database with a new Confluence instance (of the destination version). Use the Confluence Setup Guide.
Import your XML backup from step 1 during the setup wizard.
Was this helpful?