From 7d607d91c19a6713303bf25c94bd4b5cf06cde30 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 23 Apr 2013 16:11:17 +0200 Subject: [PATCH] Perl-DB-Upgradescripte refactoring: Bugfix #1 --- SL/DBUpgrade2.pm | 4 +--- .../auth_schema_normalization_1.pl | 16 +++------------- 2 files changed, 4 insertions(+), 16 deletions(-) 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; -- 2.20.1