- unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
- push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
+ unshift(@INC, $FindBin::Bin . '/../modules/override'); # Use our own versions of various modules (e.g. YAML).
+ push (@INC, $FindBin::Bin . '/..');
my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help);
my ($opt_user, $opt_client, $opt_apply, $opt_applied, $opt_unapplied, $opt_format, $opt_test_utf8);
my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword, $opt_create, $opt_type);
my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help);
my ($opt_user, $opt_client, $opt_apply, $opt_applied, $opt_unapplied, $opt_format, $opt_test_utf8);
my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword, $opt_create, $opt_type);
-my ($opt_description, $opt_encoding, @opt_depends, $opt_auth_db);
+my ($opt_description, @opt_depends, $opt_auth_db);
our (%myconfig, $form, $user, $auth, $locale, $controls, $dbupgrader);
our (%myconfig, $form, $user, $auth, $locale, $controls, $dbupgrader);
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
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
--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
--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
Options for --create:
--type \'sql\' or \'pl\'. Defaults to sql.
--description The description field of the generated upgrade.
Options for --create:
--type \'sql\' or \'pl\'. Defaults to sql.
--description The description field of the generated upgrade.
--depends Tags of upgrades which this upgrade depends upon.
Defaults to the latest stable release upgrade.
Multiple values possible.
--depends Tags of upgrades which this upgrade depends upon.
Defaults to the latest stable release upgrade.
Multiple values possible.
my $dbupgrader = $params{dbupgrader};
my $type = $params{type} || 'sql';
my $description = $params{description} || '';
my $dbupgrader = $params{dbupgrader};
my $type = $params{type} || 'sql';
my $description = $params{description} || '';
print $fh "$comment \@tag: $filename\n";
print $fh "$comment \@description: $description\n";
print $fh "$comment \@depends: @depends\n";
print $fh "$comment \@tag: $filename\n";
print $fh "$comment \@description: $description\n";
print $fh "$comment \@depends: @depends\n";
- print $fh "$comment \@encoding: $encoding\n";
+
+ if ($type eq 'pl') {
+ print $fh "package SL::DBUpgrade2::$filename;\n";
+ print $fh "\n";
+ print $fh "use strict;\n";
+ print $fh "use utf8;\n" if $encoding =~ /utf.?8/i;
+ print $fh "\n";
+ print $fh "use parent qw(SL::DBUpgrade2::Base);\n";
+ print $fh "\n";
+ print $fh "sub run {\n";
+ print $fh " my (\$self) = \@_;\n";
+ print $fh "\n";
+ print $fh "}\n";
+ print $fh "\n";
+ print $fh "1;\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);
"applied" => \$opt_applied,
"create=s" => \$opt_create,
"type=s" => \$opt_type,
"applied" => \$opt_applied,
"create=s" => \$opt_create,
"type=s" => \$opt_type,
"description=s" => \$opt_description,
"depends=s" => \@opt_depends,
"unapplied" => \$opt_unapplied,
"description=s" => \$opt_description,
"depends=s" => \@opt_depends,
"unapplied" => \$opt_unapplied,
dbupgrader => $dbupgrader,
type => $opt_type,
description => $opt_description,
dbupgrader => $dbupgrader,
type => $opt_type,
description => $opt_description,
depends => \@opt_depends) if ($opt_create);
if ($opt_client && !connect_auth()->set_client($opt_client)) {
depends => \@opt_depends) if ($opt_create);
if ($opt_client && !connect_auth()->set_client($opt_client)) {