Commit | Line | Data |
35a1938f |
1 | package SQL::Translator::Producer::DiaUml; |
2 | |
35a1938f |
3 | =pod |
4 | |
5 | =head1 NAME |
6 | |
7 | SQL::Translator::Producer::DiaUml - |
8 | Produces dia UML diagrams from schema. |
9 | |
10 | =head1 SYNOPSIS |
11 | |
12 | use SQL::Translator; |
13 | my $translator = SQL::Translator->new( |
14 | from => 'MySQL', |
15 | filename => 'foo_schema.sql', |
16 | to => 'DiaUml', |
17 | ); |
18 | print $translator->translate; |
19 | |
20 | =head1 DESCRIPTION |
21 | |
22 | Currently you will get one class (with the a table |
23 | stereotype) generated per table in the schema. The fields are added as |
24 | attributes of the classes and their datatypes set. It doesn't currently set any |
a0ee29e3 |
25 | of the relationships. It doesn't do any layout, all the classes are in one big |
35a1938f |
26 | stack. However it is still useful as you can use the layout tools in Dia to |
27 | automatically arrange them horizontally or vertically. |
28 | |
29 | =head2 Producer Args |
30 | |
31 | =over 4 |
32 | |
33 | =back |
34 | |
35 | =cut |
36 | |
35a1938f |
37 | use strict; |
f27f9229 |
38 | use warnings; |
35a1938f |
39 | |
0c04c5a2 |
40 | our ( $DEBUG, @EXPORT_OK ); |
41 | our $VERSION = '1.59'; |
35a1938f |
42 | $DEBUG = 0 unless defined $DEBUG; |
43 | |
6e64adbe |
44 | use File::ShareDir qw/dist_dir/; |
45 | |
35a1938f |
46 | use SQL::Translator::Utils 'debug'; |
35a1938f |
47 | use base qw/SQL::Translator::Producer::TT::Base/; |
48 | # Convert produce call into a method call on our class |
49 | sub produce { return __PACKAGE__->new( translator => shift )->run; }; |
50 | |
35a1938f |
51 | sub tt_config { |
6e64adbe |
52 | ( INCLUDE_PATH => File::Spec->catdir (dist_dir('SQL-Translator'), 'DiaUml') ); |
35a1938f |
53 | } |
54 | |
55 | sub tt_schema { 'schema.tt2' } |
56 | |
57 | 1; |
58 | |
35a1938f |
59 | =pod |
60 | |
61 | =head1 AUTHOR |
62 | |
63 | Mark Addison E<lt>grommit@users.sourceforge.netE<gt>. |
64 | |
65 | =head1 TODO |
66 | |
a0ee29e3 |
67 | * Add the foreign keys from the schema as UML relations. |
35a1938f |
68 | |
69 | * Layout the classes. |
70 | |
71 | =head1 SEE ALSO |
72 | |
73 | SQL::Translator. |
74 | |
75 | =cut |