Over a chat on the #workbench IRC channel, Collin Cusce has written a handy little Lua script to automatically create relationships (through foreign keys) for his reverse engineered database.
Reverse engineering the DB to import tables into a diagram was easy, but their database used no “hard” foreign keys and an ER diagram without relationships wouldn’t be of much use. So one option would be to individually connect each foreign key column pair by hand, using the relationship picking tool . But doing that for the thirty-something tables in the database would be too much work and something could be overlooked and left out. The other option would be to automate that, since all such foreign keys followed a naming convention like <table>_id<column> or fk_id<table>. And that led to the following (slightly modified) …
[Read more]