Bug #63934 Forward engineering doesn't generate foreign key for self references

Submitted: 5 Jan 2012 13:18 Modified: 10 Jan 2012 12:52
Reporter: Karsten Wutzke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:5.2.37 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[5 Jan 2012 13:18] Karsten Wutzke
Description:
Opening a model containing a table that has a foreign key to itself isn't generated at all.

This is a complete blocker, please fix ASAP.

How to repeat:
Open/create model with a table that has a one-to-many FK to itself (e.g. from parent_id to id) and forward engineer. The FK declaration is missing.
[5 Jan 2012 13:35] Valeriy Kravchuk
Thank you for the bug report. Verified with your .mwb file uploaded on Windows XP.
[5 Jan 2012 23:17] Alfredo Kojima
Have you tried setting the storage engine of the tables to InnoDB?
[6 Jan 2012 0:37] Karsten Wutzke
I set every table to "Server Default".

Where do you find the true value then? (Sorry I'm on a fresh system and I don't remember all the configs I made.)
[6 Jan 2012 0:41] Karsten Wutzke
Is it under Model -> Model Options... -> Diagram -> Default Stroage Engine? This option is set in the model to InnoDB.
[6 Jan 2012 14:03] Alfredo Kojima
Tables without an Engine set are being treated as unable to support FKs.
That will be changed, but meanwhile, a workaround would be to explicitly set 
the tables to InnoDB
[6 Jan 2012 22:12] Karsten Wutzke
Actually the more comfortable workaround is not to use 5.2.37...
[10 Jan 2012 0:17] Philip Olson
Fixed as of 5.2.38:

Tables without an engine set were treated as though they were
unable to support foreign keys. Therefore, the foreign key
declaration would be missing after forward engineering these
tables.

A workaround is to explicitly set the table engine to InnoDB.
[10 Jan 2012 12:52] Karsten Wutzke
Does the fix also work when "Server Default" is set and the model or global option is set to InnoDB for example?

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.