[Phpwm] Database Diagram from SQL definition

Ian Munday ian.munday at illumen.co.uk
Tue Mar 7 14:06:16 GMT 2006


I apologise for being slightly off topic, but I need to produce a  
database diagram (of a type suitable to present to a client) from a  
manually written SQL definition file of the following format:

----------

CREATE TABLE tbl_Divisions (
   ID int(11) NOT NULL auto_increment,
   Name varchar(100) NOT NULL default '',
   ...
   PRIMARY KEY  (ID),
   UNIQUE KEY Name (Name)
) TYPE=InnoDB;

CREATE TABLE tbl_Departments (
   ID int(11) NOT NULL auto_increment,
   DivisionID int(11) NOT NULL default '0',
   Name varchar(100) NOT NULL default '',
   ...
   PRIMARY KEY  (ID),
   UNIQUE KEY DivisionID (DivisionID,Name),
   KEY IX_tbl_Departments_DivisionID (DivisionID),
   CONSTRAINT `tbl_Departments__ibfk1` FOREIGN KEY (`DivisionID`)  
REFERENCES `tbl_Divisions` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) TYPE=InnoDB;

...

----------

Ideally it would be of the form that you would see in SQL Server.

I thought of writing a quick script in PHP to parse table definitions  
and display them in formatted tables on a web page, but I can't  
believe I wouldn't be reinventing the wheel.

Anybody needed to do this in the past?

Many thanks,

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20060307/30d71452/attachment.html


More information about the Phpwm mailing list