RE: [CDBI] ERD's
"Daniel Williams" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <5B0731A8753509478386ED3D6513B2D102369359@isp-per-exch01.win2k.iinet.net.au> |
It's definitely close to what I'm looking for. I tinkered a whole with the script and unfortunately I have multiple primary keys in some circumstances in mysql which means the primary keys are set wrong with loader which in turn confuses has_a. Infact the database I'm forced to work with is very poor. I think I will just re-write Class::DBI::Loader::Graphiz to be Class::DBI::Graphiz. I'll post the finished product to cpan or similar. Daniel -----Original Message----- From: Andrew O'Brien [mailto:[email protected]] Sent: Thursday, 16 November 2006 12:14 PM To: classdbi-Ra3b/[email protected] Subject: RE: [CDBI] ERD's Hi Daniel, > Does anyone know of scripts/module that can create pretty > ERD's based on > my Class::DBI. Have a look at: GraphViz GraphViz::DBI Class::DBI::Loader::GraphViz If you've got a supported DB with detectable/programmable foreign keys then they work reasonably well. The output isn't the prettiest thing you've ever seen but it works. I have the extra problem that relationships in my particular case (mysql w/o foreign key constraints and some strangely inconsistent fk naming on columns) need to come from Class::DBI modules rather than from the DB. I whipped up a quick wrapper script then generates & executes another perl script with the has_a relationships hard coded. There are probably better ways to do this but it worked for me :) Comes with command line help but a sample execution: ./db_diagram.pl --module_base Oriel::Something --path ~/src/lib/Oriel/Something --dsn 'dbi:mysql:something' --user andrewo --pass password --outfile diagram.ps It can also optionally munge the (occasionally large-scale) [e]ps output file to force it to A3 as we have an A3 printer here. Works well enough but assumes you're in a unix environment with the psnup command. If this is something that people find useful I can probably fix it up/extend it further. Hope it helps! Andrew