I ask generally about architecture of creating auto-generated scripts.
I try to update from 3.0 to 4.0 on MySQL and upgrade fails because of auto-generated scripts. They try to alter jbpm tables, to add foreign keys and indexes, but these fk and index already exists, for example:
INFO [domain.schema.SchemaBootstrap] [main] Executing database script /alfresco/alfresco-4.0.c/tomcat/temp/Alfresco/AlfrescoSchema-MySQLInnoDBDialect-Update-6151571554838148656.sql (Generated).
ERROR [domain.schema.SchemaBootstrap] [main] Statement execution failed:
SQL: alter table JBPM_BYTEARRAY add index FK_BYTEARR_FILDEF (FILEDEFINITION_), add constraint FK_BYTEARR_FILDEF foreign key (FILEDEFINITION_) references JBPM_MODULEDEFINITION (ID_)
Error: Can't create table 'alfresco1.#sql-6860_11e' (errno: 121)
File: /alfresco/alfresco-4.0.c/tomcat/temp/Alfresco/AlfrescoSchema-MySQLInnoDBDialect-Update-6151571554838148656.sql
Line: 35
ERROR [domain.schema.SchemaBootstrap] [main] Schema auto-update failed