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)) {
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;