1 package SQL::Translator::Producer::DiaUml;
3 # -------------------------------------------------------------------
4 # $Id: DiaUml.pm,v 1.2 2006-03-06 13:08:43 grommit Exp $
5 # -------------------------------------------------------------------
6 # Copyright (C) 2002-4 SQLFairy Authors
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; version 2.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # -------------------------------------------------------------------
27 SQL::Translator::Producer::DiaUml -
28 Produces dia UML diagrams from schema.
33 my $translator = SQL::Translator->new(
35 filename => 'foo_schema.sql',
38 print $translator->translate;
42 Currently you will get one class (with the a table
43 stereotype) generated per table in the schema. The fields are added as
44 attributes of the classes and their datatypes set. It doesn't currently set any
45 of the relationships. It doesn't do any layout, all the classses are in one big
46 stack. However it is still useful as you can use the layout tools in Dia to
47 automatically arrange them horizontally or vertically.
57 # -------------------------------------------------------------------
61 use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
62 $VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
63 $DEBUG = 0 unless defined $DEBUG;
65 use SQL::Translator::Utils 'debug';
66 use base qw/SQL::Translator::Producer::TT::Base/;
67 # Convert produce call into a method call on our class
68 sub produce { return __PACKAGE__->new( translator => shift )->run; };
70 # Uses dir in lib with this mods name as the template dir
71 my $_TEMPLATE_DIR = __FILE__;
72 $_TEMPLATE_DIR =~ s/\.pm$//;
75 ( INCLUDE_PATH => $_TEMPLATE_DIR );
78 sub tt_schema { 'schema.tt2' }
82 # -------------------------------------------------------------------
88 Mark Addison E<lt>grommit@users.sourceforge.netE<gt>.
92 * Add the foriegn keys from the schema as UML relations.