BEGIN {
if (! -d "bin" || ! -d "SL") {
- print("This tool must be run from the Lx-Office ERP base directory.\n");
+ print("This tool must be run from the kivitendo ERP base directory.\n");
exit(1);
}
for it\'s option \'-T\' are acceptable.
--nodeps List all database upgrades that no other upgrade
depends on
+ --create=tag Creates a new upgrade with the supplied tag. This
+ action accepts several optional other options. See
+ the option section for those. After creating the
+ 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.
and --dbpassword.
--help Show this help and exit.
- Options:
+ General Options:
--user=name The name of the user configuration to use for
database connectivity.
--dbname=name Database connection options for the UTF-8
--dbuser=user
--dbpassword=pw
+ Options for --create:
+ --type \'sql\' or \'pl\'. Defaults to sql.
+ --description The description field of the generated upgrade.
+ --encoding Encoding used for the file. Defaults to \'utf8\'.
+ Note: Your editor will not be told to open the file in
+ this encoding.
+ --depends Tags of upgrades which this upgrade depends upon.
+ Defaults to the latest stable release upgrade.
+ Multiple values possible.
+
END_HELP
;
my $filename = $params{filename};
my $dbupgrader = $params{dbupgrader};
- my $type = $params{type} || '';
+ my $type = $params{type} || 'sql';
my $description = $params{description} || '';
my $encoding = $params{encoding} || 'utf-8';
my @depends = @{ $params{depends} };
print $fh "$comment \@encoding: $encoding\n";
close $fh;
+ print "File $full_filename created.\n";
+
system("\$EDITOR $full_filename");
exit 0;
}
exit 0;
}
+ my $db_charset = $::lx_office_conf{system}->{dbcharset};
+ $db_charset ||= Common::DEFAULT_CHARSET();
+
foreach my $control (@upgradescripts) {
$control->{file} =~ /\.(sql|pl)$/;
my $file_type = $1;
print "Applying upgrade $control->{file}\n";
if ($file_type eq "sql") {
- $dbupgrader->process_query($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
+ $dbupgrader->process_query($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control, $db_charset);
} else {
- $dbupgrader->process_perl_script($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
+ $dbupgrader->process_perl_script($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control, $db_charset);
}
}