Bug #41677 Creation SQL should use external constraints at the end of script
Submitted: 22 Dec 2008 15:34 Modified: 19 Oct 2009 13:50
Reporter: stonebrad unlojitop Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S2 (Serious)
Version:1.1.15 OS:Any
Assigned to: CPU Architecture:Any
Tags: CHECKED, sql creation script constraints errno150

[22 Dec 2008 15:34] stonebrad unlojitop
Description:
Apparently the SQL generated for target database creation declares all tables in alphabetical order so there are some CONSTRAINT directives that will fail if the referenced table has not been created yet (eg. the referenced table is declared later in the script).

How to repeat:
Migrate a db with one table A that references a table B.
The CREATE TABLE A statement will fail, unless we create table B first.

Suggested fix:
Instead of declaring FK CONSTRAINTS at CREATE TABLE scope use 'alter table / add constraint' syntax at the end of the whole script to ensure that all table have been created.
This applies to TRIGGERS, too.

Optionally enable a 'Use customized script' feature at the Object Creation Options window.
[22 Dec 2008 20:30] MySQL Verification Team
Thank you for the bug report.
[19 Oct 2009 13:50] Susanne Ebrecht
Many thanks for writing a bug report. We are on the way to implement full functionality of MySQL Migration Tool into MySQL Workbench. We won't fix this anymore.

More informations about MySQL Workbench you will find here:

http://dev.mysql.com/workbench/