X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fdbupgrade2_tool.pl;h=e62a9aaba36d4fe76639898c77d53b43db17b8df;hb=957896de327365e3d83e3f0d6525af02849c483d;hp=31b997c3c24576008f65d615aa0014f588d625ac;hpb=92fc1394dae925962c06e0250d9f1901e89b96d1;p=kivitendo-erp.git diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 31b997c3c..e62a9aaba 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -6,7 +6,8 @@ BEGIN { exit(1); } - push(@INC, "modules"); + unshift @INC, "modules/YAML"; # Use our own version of YAML. + push @INC, "modules"; # Only use our own versions of modules if there's no system version. } use English '-no_match_vars'; @@ -54,6 +55,8 @@ dbupgrade2_tool.pl [options] all database upgrades and their dependencies. If no file name is given then the output is written to 'db_dependencies.ps'. + --nodeps List all database upgrades that no other upgrade + depends on --apply=tag Applies the database upgrades 'tag' and all upgrades it depends on. If '--apply' is used then the option '--user' must be used as well. @@ -65,7 +68,10 @@ dbupgrade2_tool.pl [options] END_HELP ; + # Syntax-Highlighting-Fix für Emacs: ' + print $help_text; + exit 0; } @@ -152,20 +158,25 @@ sub dump_graphviz { print("GRAPHVIZ POSTCRIPT\n\n"); print("Output will be written to '${file_name}'\n"); + + calc_rev_depends(); + $dot = "|dot -Tps "; - open(OUT, "${dot}> \"${file_name}\""); + open OUT, "${dot}> \"${file_name}\"" || die; + print(OUT "digraph db_dependencies {\n" . - "node [shape=box];\n"); + "node [shape=box style=filled fillcolor=white];\n"); my %ranks; foreach my $c (values(%{$controls})) { - $ranks{$c->{"depth"}} = [] unless ($ranks{$c->{"depth"}}); - push(@{$ranks{$c->{"depth"}}}, $c->{"tag"}); + $ranks{$c->{"depth"}} ||= []; + + my ($pre, $post) = ('node [fillcolor=lightgray] ', 'node [fillcolor=white] ') if !@{ $c->{"rev_depends"} }; + + push @{ $ranks{$c->{"depth"}} }, qq|${pre}"$c->{tag}"; ${post}|; } foreach (sort(keys(%ranks))) { - print(OUT "{ rank = same; " . - join("", map({ '"' . $_ . '"; ' } @{$ranks{$_}})) . - " }\n"); + print OUT "{ rank = same; ", join("", @{ $ranks{$_} }), " }\n"; } foreach my $c (values(%{$controls})) { print(OUT "$c->{tag};\n");