View | Details | Raw Unified | Return to bug 23590
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_23590.perl (-1 / +22 lines)
Lines 13-18 if( CheckVersion( $DBversion ) ) { Link Here
13
        $dbh->do(q|
13
        $dbh->do(q|
14
            ALTER TABLE suggestions ADD COLUMN lastmodificationdate DATE DEFAULT NULL AFTER lastmodificationby
14
            ALTER TABLE suggestions ADD COLUMN lastmodificationdate DATE DEFAULT NULL AFTER lastmodificationby
15
        |);
15
        |);
16
17
        my $suggestions = $dbh->selectall_arrayref(q|
18
            SELECT suggestionid, managedby, manageddate, acceptedby, accepteddate, rejectedby, rejecteddate
19
            FROM suggestions
20
        |, { Slice => {} });
21
        for my $suggestion ( @$suggestions ) {
22
            my ( $max_date ) = sort ( $suggestion->{manageddate} || (), $suggestion->{accepteddate} || (), $suggestion->{rejecteddate} || () );
23
            next unless $max_date;
24
            my $last_modif_by = ( defined $suggestion->{manageddate} and $max_date eq $suggestion->{manageddate} )
25
              ? $suggestion->{managedby}
26
              : ( defined $suggestion->{accepteddate} and $max_date eq $suggestion->{accepteddate} )
27
              ? $suggestion->{acceptedby}
28
              : ( defined $suggestion->{rejecteddate} and $max_date eq $suggestion->{rejecteddate} )
29
              ? $suggestion->{rejectedby}
30
              : undef;
31
            next unless $last_modif_by;
32
            $dbh->do(q|
33
                UPDATE suggestions
34
                SET lastmodificationdate = ?, lastmodificationby = ?
35
                WHERE suggestionid = ?
36
            |, undef, $max_date, $last_modif_by, $suggestion->{suggestionid});
37
        }
16
    }
38
    }
17
39
18
    # Always end with this (adjust the bug info)
40
    # Always end with this (adjust the bug info)
19
- 

Return to bug 23590