File: pg2graphviz_svg.pl

package info (click to toggle)
libchado-perl 1.22-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 24,024 kB
  • sloc: xml: 192,540; sql: 165,936; perl: 28,298; sh: 101; python: 73; makefile: 46
file content (36 lines) | stat: -rwxr-xr-x 970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

use SQL::Translator;
use Data::Dumper;   
use lib './bin';
use Skip_tables qw( @skip_tables );

$SQL::Translator::DEBUG = 0;

my $in = shift;
open(IN,$in) || die "couldn't open $in: $!";

my @create = <IN>;
my $create = join '', @create;

my $tr = SQL::Translator->new(
				parser   => "PostgreSQL",
				producer => "GraphViz",
				producer_args => {
						   output_type => 'svg',
						   width => 10,
						   height => 8,
						   layout => 'neato',
						 },
                                filters       => [
                                   sub {
                                      my $schema = shift;
                                      foreach (@skip_tables) {
                                         $schema->drop_table($_);
                                      }
                                   },
                                ],

                             );
                               
print $tr->translate(\$create);