Bug #63946 Missing foreign keys in forward engineered sql export
Submitted: 6 Jan 2012 9:30 Modified: 12 Feb 2012 17:41
Reporter: Frederik T Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.37 OS:Linux (Ubuntu 11.10)
Assigned to: CPU Architecture:Any

[6 Jan 2012 9:30] Frederik T
Description:
Hello everybody,

I was missing some (not alle) forgein key constraints when exporting my database model with the forward engineer sql create script.

I found out that "Engine" was not set on all tables. An the constraints were missing on that tables where "Engine" was not set.

The database model was first edited with mysql workbench 5.2.35.1 on Win 7.

How to repeat:
Create a database model with mysql workbench 5.2.35.1 on Win 7 an reopen it with 5.2.37 under Linux.

Suggested fix:
Set "Engine" to "InnoDB" to fix this issue.
[6 Jan 2012 11:05] MySQL Verification Team
Are you able to provide a model file to test on Linux that behavior?. Thanks.
[6 Jan 2012 11:09] Frederik T
I'm sorry to tell you that I can't provide the model file. It's for a company I work for. They are not willing to provide their proprietary data.

I could do some tests for you.
[11 Jan 2012 20:48] Armando Lopez Valencia
Hello Frederik.
Can you create a new (no work related) model where you can reproduce this bug and share it with us?
Thanks.
[11 Jan 2012 21:12] Frederik T
Yes I can..

To repeat import init.sql and create diagram.

See that the database engine has no default type and is not set.

Export and see that no foreign keys are exported.

If you set the engine type to InnoDB the foreign keys are there.

Regards Frederik
[12 Jan 2012 17:41] Valeriy Kravchuk
Well, only InnoDB engine really supports FOREIGN KEY clauses. Other engines just parse and ignore them. Read http://dev.mysql.com/doc/refman/5.1/en/create-table.html:

"For other storage engines, MySQL Server parses and ignores the FOREIGN KEY and REFERENCES syntax in CREATE TABLE statements."

So, if default engine is NOT InnoDB, and engine for tables is not set explicitly, I'd say this is not a bug.
[13 Feb 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".