X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fdebbugs-installsql;h=1ecccb48534799372ef9b5de4241ef2c0f9d7031;hb=6532b246361b5d28b6ce3b44154a71edd3ca9a9e;hp=8d8437ace3c219da8200a410b6618dd7fdd59991;hpb=77d7273afd35f0069bdc8aea2732c725a869452b;p=debbugs.git diff --git a/bin/debbugs-installsql b/bin/debbugs-installsql index 8d8437a..1ecccb4 100755 --- a/bin/debbugs-installsql +++ b/bin/debbugs-installsql @@ -45,6 +45,11 @@ environmental variable (which this option overrides). Deployment directory (defaults to /usr/share/debbugs/sqldeployment) +=item B<--drop> + +Drop tables before trying to create them. (Useful for --install, primarily). +Defaults to not drop tables for safety. + =item B<--debug, -d> Debug verbosity. (Default 0) @@ -68,6 +73,13 @@ debbugs-installsql use vars qw($DEBUG); +# if we're running out of git, we want to use the git base directory as the +# first INC directory. If you're not running out of git, or someone has given a +# non-absolute INC, don't do that. +use FindBin; +use if (-d $FindBin::Bin.'/../.git/' && $INC[0] =~ m#^/#), + lib => $FindBin::Bin.'/../'; + use Debbugs::DB; use Debbugs::DB::Util qw(prepare_execute); use aliased 'DBIx::Class::DeploymentHandler' => 'DH'; @@ -76,6 +88,7 @@ my %options = (debug => 0, help => 0, man => 0, overwrite_deployment => 0, + drop => 0, service => 'debbugs', deployment_dir => '/usr/share/debbugs/sqldeployment', ); @@ -87,6 +100,7 @@ GetOptions(\%options, 'install', 'install_version_storage|install-version-storage', 'upgrade', + 'drop', 'current_version|current-version', 'overwrite_deployment|overwrite-deployment|force_overwrite|force-overwrite', 'deployment_dir|deployment-dir=s', @@ -134,7 +148,9 @@ my $dh = DH->new({schema => $schema, force_overwrite => $options{overwrite_deployment}, script_directory => $options{deployment_dir}, databases => 'PostgreSQL', - sql_translator_args => {producer_args=> {postgres_version => 9}}, + sql_translator_args => {producer_args => {postgres_version => 8.1}, + add_drop_table => $options{drop}, + }, }); if ($options{current_version}) {