| 1 | package SQL::Translator::Producer::DiaUml; | ||
| 2 | |||
| 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 | ||
| 25 | of the relationships. It doesn't do any layout, all the classes are in one big | ||
| 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 | =cut | ||
| 32 | |||
| 33 | use strict; | ||
| 34 | use warnings; | ||
| 35 | |||
| 36 | our ($DEBUG, @EXPORT_OK); | ||
| 37 | our $VERSION = '1.66'; | ||
| 38 | $DEBUG = 0 unless defined $DEBUG; | ||
| 39 | |||
| 40 | use File::ShareDir qw/dist_dir/; | ||
| 41 | |||
| 42 | use SQL::Translator::Utils 'debug'; | ||
| 43 | use base qw/SQL::Translator::Producer::TT::Base/; | ||
| 44 | |||
| 45 | # Convert produce call into a method call on our class | ||
| 46 | sub produce { return __PACKAGE__->new(translator => shift)->run; } | ||
| 47 | |||
| 48 | sub tt_config { | ||
| 49 | (INCLUDE_PATH => File::Spec->catdir(dist_dir('SQL-Translator'), 'DiaUml')); | ||
| 50 | } | ||
| 51 | |||
| 52 | sub tt_schema {'schema.tt2'} | ||
| 53 | |||
| 54 | 1; | ||
| 55 | |||
| 56 | =pod | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Mark Addison E<lt>grommit@users.sourceforge.netE<gt>. | ||
| 61 | |||
| 62 | =head1 TODO | ||
| 63 | |||
| 64 | * Add the foreign keys from the schema as UML relations. | ||
| 65 | |||
| 66 | * Layout the classes. | ||
| 67 | |||
| 68 | =head1 SEE ALSO | ||
| 69 | |||
| 70 | SQL::Translator. | ||
| 71 | |||
| 72 | =cut |