'Foreign key has implicit reference to object which does not have a primary key defined on it' error is thrown during Confluence upgrade
When upgrading, Confluence is inaccessible after startup. An error appears in the logs like:
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)
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.
- 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.