Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7d607d91

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 7d607d91c19a6713303bf25c94bd4b5cf06cde30
  • Vorgänger f1a40f51
  • Nachfolger cb575f7d

Perl-DB-Upgradescripte refactoring: Bugfix #1

Unterschiede anzeigen:

SL/DBUpgrade2.pm
250 250
    file_name => $filename,
251 251
    tag       => $version_or_control->{tag},
252 252
    dbh       => $dbh,
253
    locale    => $::locale,
254 253
    myconfig  => \%dbup_myconfig,
255 254
  );
256 255

  
257
  if (1 != $result) {
256
  if (1 != ($result // 1)) {
258 257
    $dbh->rollback();
259
    $dbh->disconnect();
260 258
  }
261 259

  
262 260
  if (!defined($result)) {
sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl
8 8

  
9 9
use parent qw(SL::DBUpgrade2::Base);
10 10

  
11
sub do_one {
12
  my ($self, $query) = @_;
13

  
14
  if ($self->dbh->do($query)) {
15
    $self->dbh->commit();
16
  } else {
17
    $self->dbh->rollback();
18
  }
19
}
20

  
21 11
sub run {
22 12
  my ($self) = @_;
23 13

  
24
  $self->dbh($::auth->dbconnect);
25

  
26 14
  my @queries = ( qq|ALTER TABLE auth.group_rights ADD PRIMARY KEY (group_id, "right");|,
27 15
                  qq|ALTER TABLE auth.user_config  ADD PRIMARY KEY (user_id,  cfg_key);|,
28 16
                  qq|ALTER TABLE auth.user_group   ADD PRIMARY KEY (user_id,  group_id);|);
29 17

  
30
  $self->do_one($_) for @queries;
18
  $self->db_query($_, 1) for @queries;
19

  
20
  return 1;
31 21
}
32 22

  
33 23
1;

Auch abrufbar als: Unified diff