I am working with MYSQL WORKBENCH. After forward engineer I got all my tables in phpadmin.
But the reverse enginner transforms 1:1 to 1:n .
How can I fix this?
I am working with MYSQL WORKBENCH. After forward engineer I got all my tables in phpadmin.
But the reverse enginner transforms 1:1 to 1:n .
How can I fix this?
I believe it's a limitation of the forward and reverse engineering processes in MySQL Workbench. The cardinality of the relationship should determine the type of index used for the generated foreign key. Hence a unique index (or a primary key, which is per definition unique) are needed for a cardinality of 1. A non-unique index allows the 1..n cardinality. You cannot model the 0..1 cardinality with foreign keys, however, as foreign keys always require at least one entry (that's their entire purpose, after all).
If you like you can create a bug report (http://bugs.mysql.com) to have this improved.
Yes,I faced this problem when using django to model 1:1 relationship like this:
class Server(models.Model):
...
asset = models.OneToOneField('Asset', on_delete=models.CASCADE, null=True, blank=True)
after python makemigrations & python migrate, I run mysql workbench(6.3 on ubuntu16.04) reverse engineer,than something show as follow: 1_to_1_bug.png