Commit | Line | Data |
35a1938f |
1 | package SQL::Translator::Producer::DiaUml; |
2 | |
3 | # ------------------------------------------------------------------- |
821a0fde |
4 | # $Id$ |
35a1938f |
5 | # ------------------------------------------------------------------- |
478f608d |
6 | # Copyright (C) 2002-2009 SQLFairy Authors |
35a1938f |
7 | # |
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. |
11 | # |
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. |
16 | # |
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 |
20 | # 02111-1307 USA |
21 | # ------------------------------------------------------------------- |
22 | |
23 | =pod |
24 | |
25 | =head1 NAME |
26 | |
27 | SQL::Translator::Producer::DiaUml - |
28 | Produces dia UML diagrams from schema. |
29 | |
30 | =head1 SYNOPSIS |
31 | |
32 | use SQL::Translator; |
33 | my $translator = SQL::Translator->new( |
34 | from => 'MySQL', |
35 | filename => 'foo_schema.sql', |
36 | to => 'DiaUml', |
37 | ); |
38 | print $translator->translate; |
39 | |
40 | =head1 DESCRIPTION |
41 | |
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. |
48 | |
49 | =head2 Producer Args |
50 | |
51 | =over 4 |
52 | |
53 | =back |
54 | |
55 | =cut |
56 | |
57 | # ------------------------------------------------------------------- |
58 | |
59 | use strict; |
60 | |
478f608d |
61 | use vars qw[ $DEBUG @EXPORT_OK ]; |
35a1938f |
62 | $DEBUG = 0 unless defined $DEBUG; |
63 | |
64 | use SQL::Translator::Utils 'debug'; |
35a1938f |
65 | use base qw/SQL::Translator::Producer::TT::Base/; |
66 | # Convert produce call into a method call on our class |
67 | sub produce { return __PACKAGE__->new( translator => shift )->run; }; |
68 | |
8fbe040d |
69 | # Uses dir in lib with this mods name as the template dir |
70 | my $_TEMPLATE_DIR = __FILE__; |
71 | $_TEMPLATE_DIR =~ s/\.pm$//; |
72 | |
35a1938f |
73 | sub tt_config { |
8fbe040d |
74 | ( INCLUDE_PATH => $_TEMPLATE_DIR ); |
35a1938f |
75 | } |
76 | |
77 | sub tt_schema { 'schema.tt2' } |
78 | |
79 | 1; |
80 | |
81 | # ------------------------------------------------------------------- |
82 | |
83 | =pod |
84 | |
85 | =head1 AUTHOR |
86 | |
87 | Mark Addison E<lt>grommit@users.sourceforge.netE<gt>. |
88 | |
89 | =head1 TODO |
90 | |
91 | * Add the foriegn keys from the schema as UML relations. |
92 | |
93 | * Layout the classes. |
94 | |
95 | =head1 SEE ALSO |
96 | |
97 | SQL::Translator. |
98 | |
99 | =cut |