1

I am using tank_auth library for authentication in Codeigniter. I want to draw ER-diagram for tank_auth sql file.

When I imported sql file (reverse engineering) in mysql workbench it shows all table without any relationship between tables (users, user_profiles, user_autologin, login_attempts, ci_sessions ).

how could I get Er-diagram from given sql file ?

ravins
  • 139
  • 3
  • 9

2 Answers2

1

MySQL Workbench derives relationships in diagrams from existing foreign keys. If your tables use engines that don't support foreign keys no relationships can be derived automatically.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • I've go through sql file and seems that there is no foreign key. I've also used Wordpress sql file but there is also no foreign key available (I'm surprised that Wordpress is not using foreign key for relationship). Anyway if there is any suggestion so that I can make relationship between tables in my case. – ravins Oct 21 '13 at 17:00
  • It's difficult to automatically create relationships. Some tools use name similarities between tables but that's really unreliable. So the only reliable solution is to manually add them once and for all and change table engines to InnoDB. There's no reason anymore to prefer MyISAM over InnoDB (mentioning here only the 2 most common ones). – Mike Lischke Oct 22 '13 at 07:24
0
  • Go to to "Database" Menu option
  • Select the "Reverse Engineer" option.
  • A wizard will be open and it will ask for db configuration/source
  • On finish it will generate the ER Diagram for you