From: Moritz Bunkus Date: Tue, 23 Apr 2013 14:11:17 +0000 (+0200) Subject: Perl-DB-Upgradescripte refactoring: Bugfix #1 X-Git-Tag: release-3.1.0beta1~475 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7d607d91c19a6713303bf25c94bd4b5cf06cde30;p=kivitendo-erp.git Perl-DB-Upgradescripte refactoring: Bugfix #1 --- diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 86ae9fdee..d98627c56 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -250,13 +250,11 @@ sub process_perl_script { file_name => $filename, tag => $version_or_control->{tag}, dbh => $dbh, - locale => $::locale, myconfig => \%dbup_myconfig, ); - if (1 != $result) { + if (1 != ($result // 1)) { $dbh->rollback(); - $dbh->disconnect(); } if (!defined($result)) { diff --git a/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl index 79df5f801..3cb411b3b 100644 --- a/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl +++ b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl @@ -8,26 +8,16 @@ use utf8; use parent qw(SL::DBUpgrade2::Base); -sub do_one { - my ($self, $query) = @_; - - if ($self->dbh->do($query)) { - $self->dbh->commit(); - } else { - $self->dbh->rollback(); - } -} - sub run { my ($self) = @_; - $self->dbh($::auth->dbconnect); - my @queries = ( qq|ALTER TABLE auth.group_rights ADD PRIMARY KEY (group_id, "right");|, qq|ALTER TABLE auth.user_config ADD PRIMARY KEY (user_id, cfg_key);|, qq|ALTER TABLE auth.user_group ADD PRIMARY KEY (user_id, group_id);|); - $self->do_one($_) for @queries; + $self->db_query($_, 1) for @queries; + + return 1; } 1;