Added schema graph generator

This commit is contained in:
Tom Bloor 2017-08-31 10:48:51 +01:00
parent a30b05f1c0
commit 957e6a5162
3 changed files with 42 additions and 0 deletions

36
script/schema/graph.pl Executable file
View file

@ -0,0 +1,36 @@
#! /usr/bin/env perl
use strict;
use warnings;
use feature "say";
use FindBin qw/ $Bin /;
use lib "$Bin/../../lib";
use SQL::Translator;
use Pear::LocalLoop::Schema;
say "Setting up Translator and Schema";
my $schema = Pear::LocalLoop::Schema->connect;
my $tr = SQL::Translator->new(
from => "SQL::Translator::Parser::DBIx::Class",
to => 'GraphViz',
debug => 1,
trace => 1,
producer_args => {
out_file => "$Bin/../../schema.png",
output_type => 'png',
width => 0,
height => 0,
show_constraints => 1,
show_datatypes => 1,
show_sizes => 1,
},
);
say "Translating Schema to image";
$tr->translate( data => $schema );
say "Finished";