Revision 4627ca8b
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
scripts/dbupgrade2_tool.pl | ||
---|---|---|
42 | 42 |
####### |
43 | 43 |
|
44 | 44 |
my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help); |
45 |
my ($opt_user, $opt_apply, $opt_applied, $opt_format, $opt_test_utf8); |
|
45 |
my ($opt_user, $opt_apply, $opt_applied, $opt_unapplied, $opt_format, $opt_test_utf8);
|
|
46 | 46 |
my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword); |
47 | 47 |
|
48 | 48 |
our (%myconfig, $form, $user, $auth, $locale, $controls, $dbupgrader); |
... | ... | |
77 | 77 |
then the option \'--user\' must be used as well. |
78 | 78 |
--applied List the applied database upgrades for the |
79 | 79 |
database that the user given with \'--user\' uses. |
80 |
--unapplied List the database upgrades that haven\'t been applied |
|
81 |
yet to the database that the user given with |
|
82 |
\'--user\' uses. |
|
80 | 83 |
--test-utf8 Tests a PostgreSQL cluster for proper UTF-8 support. |
81 | 84 |
You have to specify the database to test with the |
82 | 85 |
parameters --dbname, --dbhost, --dbport, --dbuser |
... | ... | |
340 | 343 |
} |
341 | 344 |
} |
342 | 345 |
|
346 |
sub dump_unapplied { |
|
347 |
my @results; |
|
348 |
|
|
349 |
my $dbh = $form->dbconnect_noauto(\%myconfig); |
|
350 |
|
|
351 |
$dbh->{PrintWarn} = 0; |
|
352 |
$dbh->{PrintError} = 0; |
|
353 |
|
|
354 |
my @unapplied = $dbupgrader->unapplied_upgrade_scripts($dbh); |
|
355 |
|
|
356 |
$dbh->disconnect; |
|
357 |
|
|
358 |
if (!scalar @unapplied) { |
|
359 |
print "All database upgrades have been applied.\n"; |
|
360 |
} else { |
|
361 |
print map { $_->{tag} . "\n" } @unapplied; |
|
362 |
} |
|
363 |
} |
|
364 |
|
|
343 | 365 |
sub build_upgrade_order { |
344 | 366 |
my $name = shift; |
345 | 367 |
my $order = shift; |
... | ... | |
377 | 399 |
"user=s" => \$opt_user, |
378 | 400 |
"apply=s" => \$opt_apply, |
379 | 401 |
"applied" => \$opt_applied, |
402 |
"unapplied" => \$opt_unapplied, |
|
380 | 403 |
"test-utf8" => \$opt_test_utf8, |
381 | 404 |
"dbhost:s" => \$opt_dbhost, |
382 | 405 |
"dbport:s" => \$opt_dbport, |
... | ... | |
428 | 451 |
dump_applied(); |
429 | 452 |
} |
430 | 453 |
|
454 |
if ($opt_unapplied) { |
|
455 |
$form->error("--unapplied used but no user name given with --user.") if (!$user); |
|
456 |
dump_unapplied(); |
|
457 |
} |
|
458 |
|
|
431 | 459 |
if ($opt_test_utf8) { |
432 | 460 |
$form->error("--test-utf8 used but no database name given with --dbname.") if (!$opt_dbname); |
433 | 461 |
|
Auch abrufbar als: Unified diff
dbupgrade2_tool.pl: Option "--unapplied", zeigt nicht angewandte Upgradescripte an