We are upgrading from Confluence version 3.0.1 to 3.5.13
During the upgrade process, multiple errors are encountered (though each causes the upgrade progress to halt - after fixing the issue and resuming the next issue is found).
We are using Microsoft SQL Server 2008.
The errors are all very similar. They relate to either a foreign or primary key constraint that is missing or can't be created.
Some examples:
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table external_members add constraint FKD8C8D8A5117D5FDA foreign key (groupid) references groups
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Foreign key 'FKD8C8D8A5117D5FDA' has implicit reference to object 'groups' which does not have a primary key defined on it.
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table CONTENT_PERM_SET add constraint FKBF45A7992CAF22C1 foreign key (CONTENT_ID) references CONTENT
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Foreign key 'FKBF45A7992CAF22C1' has implicit reference to object 'CONTENT' which does not have a primary key defined on it.
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table IMAGEDETAILS add constraint FKA768048734A4917E foreign key (ATTACHMENTID) references ATTACHMENTS
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Column 'ATTACHMENTS.ATTACHMENTID' is not the same data type as referencing column 'IMAGEDETAILS.ATTACHMENTID' in foreign key 'FKA768048734A4917E'.
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table external_members add constraint FKD8C8D8A5117D5FDA foreign key (groupid) references groups
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Foreign key 'FKD8C8D8A5117D5FDA' has implicit reference to object 'groups' which does not have a primary key defined on it.
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table external_members add constraint FKD8C8D8A5F25E5D5F foreign key (extentityid) references external_entities
ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Foreign key 'FKD8C8D8A5F25E5D5F' has implicit reference to object 'external_entities' which does not have a primary key defined on it.
To resolve these issues we have had to run queries like the following:
alter table CONTENT add constraint PK_CONTENT primary key (CONTENTID)
alter table ATTACHMENTS add constraint PK_ATTACHMENTS primary key (ATTACHMENTID)
ALTER TABLE IMAGEDETAILS DROP CONSTRAINT PK_IMAGEDETAILS //not actual constraint name
alter table IMAGEDETAILS alter column ATTACHMENTID decimal (19,0) not null
alter table IMAGEDETAILS add constraint PK_IMAGEDETAILS primary key (ATTACHMENTID)
alter table groups add constraint PK_groups primary key (id)
alter table external_entities add constraint PK_external_entities primary key (id)
Do you know why this might have happened? What is the best way to proceed, as we are still getting errors and many tables that don't have primary keys seem like they should?