X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fdbupgrade2_tool.pl;h=c3ef1e76c0a423bdd37a413c2904f100b9e07726;hb=abafb475d9742e3a6c28427477235c923b21eeef;hp=d5b5ebbd5a2ddd36533b98281a1695f94d54cff0;hpb=42be914da1abc613dfa27da313f69f4dea97e909;p=kivitendo-erp.git diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index d5b5ebbd5..c3ef1e76c 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -5,7 +5,6 @@ BEGIN { unshift(@INC, $FindBin::Bin . '/../modules/override'); # Use our own versions of various modules (e.g. YAML). push (@INC, $FindBin::Bin . '/..'); - push (@INC, $FindBin::Bin . '/../modules/fallback'); # Only use our own versions of modules if there's no system version. } use strict; @@ -87,7 +86,8 @@ dbupgrade2_tool.pl [options] upgrade file your \$EDITOR will be called with it. --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. + then the option \'--user\' and \'--client\' must be + used as well. Use \'--apply=ALL\' to apply all. --applied List the applied database upgrades for the database that the user given with \'--user\' uses. --unapplied List the database upgrades that haven\'t been applied @@ -338,8 +338,7 @@ sub apply_upgrade { my @upgradescripts = map { $controls->{$_}->{applied} = 0; $controls->{$_} } @order; - my $dbh = $opt_auth_db ? connect_auth()->dbconnect : $form->dbconnect_noauto(\%myconfig); - $dbh->{AutoCommit} = 0; + my $dbh = $opt_auth_db ? connect_auth()->dbconnect : SL::DB->client->dbh; $dbh->{PrintWarn} = 0; $dbh->{PrintError} = 0; @@ -366,12 +365,7 @@ sub apply_upgrade { # apply upgrade print "Applying upgrade $control->{file}\n"; - - if ($file_type eq "sql") { - $dbupgrader->process_query($dbh, "sql/Pg-upgrade2/$control->{file}", $control); - } else { - $dbupgrader->process_perl_script($dbh, "sql/Pg-upgrade2/$control->{file}", $control); - } + $dbupgrader->process_file($dbh, "sql/Pg-upgrade2/$control->{file}", $control); } $dbh->disconnect unless $opt_auth_db; @@ -407,7 +401,7 @@ sub dump_sql_result { sub dump_applied { my @results; - my $dbh = $opt_auth_db ? connect_auth()->dbconnect : $form->dbconnect_noauto(\%myconfig); + my $dbh = $opt_auth_db ? connect_auth()->dbconnect : SL::DB->client->dbh; $dbh->{AutoCommit} = 0; $dbh->{PrintWarn} = 0; @@ -435,7 +429,7 @@ sub dump_applied { sub dump_unapplied { my @results; - my $dbh = $opt_auth_db ? connect_auth()->dbconnect : $form->dbconnect_noauto(\%myconfig); + my $dbh = $opt_auth_db ? connect_auth()->dbconnect : SL::DB->client->dbh; $dbh->{PrintWarn} = 0; $dbh->{PrintError} = 0;