If migrating or restoring to a MySQL 5.5 database our scripts will fail due to a change in the way that MySQL references the engine type. Starting with version 5.5, MySQL changed the syntax referencing the engine type from TYPE=INNODB to ENGINE=INNODB which conflicts with our current migration scripts.
Stack trace
14:43:41 ERROR - Database migration failed: com.cenqua.crucible.hibernate.CruDBException: Problem with create tables script /Users/grefosco/Documents/Atlassian/FishEye/fecru-2.2.0/sql/MYSQL/schema/tables_63.sql
com.cenqua.crucible.hibernate.CruDBException: Problem with create tables script /Users/grefosco/Documents/Atlassian/FishEye/fecru-2.2.0/sql/MYSQL/schema/tables_63.sql
at com.cenqua.crucible.hibernate.DefaultDBControl.createTables(DefaultDBControl.java:241)
at com.atlassian.crucible.migration.item.DBImporter.importData(DBImporter.java:111)
at com.cenqua.crucible.actions.admin.database.DBEditHelper$ImportRunner.call(DBEditHelper.java:78)
at com.cenqua.crucible.actions.admin.database.DBEditHelper$ImportRunner.call(DBEditHelper.java:60)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: com.cenqua.crucible.hibernate.CruDBException: SQL script error on line 1: "create table cru_base_star_model (cru_star_id integer not null, cru_item_type varchar(80) not null, cru_string_key1 varchar(255), cru_string_key2 varchar(255), cru_string_key3 varchar(255), cru_string_key4 varchar(255), cru_string_key5 varchar(255), cru_int_key1 integer, cru_int_key2 integer, cru_int_key3 integer, cru_int_key4 integer, cru_int_key5 integer, cru_text_key1 mediumtext, cru_text_key2 mediumtext, cru_user_name varchar(255), cru_date_created bigint, cru_label varchar(255), primary key (cru_star_id)) type=InnoDB;"
(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1), please contact http://www.atlassian.com/support/
at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:395)
at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:347)
at com.cenqua.crucible.hibernate.DefaultDBControl.createTables(DefaultDBControl.java:235)
... 10 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:377)
... 12 more
Workaround
The workaround is to change manually all the "TYPE=INNODB" contained in the scripts to "ENGINE=INNODB".
For instance, in the logs above, it shows /Users/grefosco/Documents/Atlassian/FishEye/fecru-2.2.0/sql/MYSQL/schema/tables_63.sql, which means the script tables_63.sql must be changed manually.