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

(-)a/installer/data/mysql/atomicupdate/bug_36002.pl (-1 / +17 lines)
Lines 6-12 return { Link Here
6
    up          => sub {
6
    up          => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
9
        if ( column_exists( 'aqorders', 'purchaseordernumber' ) ) {
10
        if ( column_exists( 'aqorders', 'purchaseordernumber' ) ) {
11
            my ($cnt) = $dbh->selectrow_array(
12
                q|
13
SELECT count(*) FROM aqorders
14
WHERE purchaseordernumber IS NOT NULL|
15
            );
16
            if( $cnt ) {
17
                say $out "We found $cnt order lines where field purchaseordernumber was filled!";
18
                $dbh->do(
19
                    q|
20
CREATE TABLE zzaqorders_purchaseordernumber AS
21
SELECT ordernumber,purchaseordernumber FROM aqorders WHERE purchaseordernumber IS NOT NULL|
22
                );
23
                say $out q|These records have been copied to table: zzaqorders_purchaseordernumber.
24
Please examine the data and remove this table.|;
25
            }
26
10
            $dbh->do(q{ALTER TABLE aqorders DROP COLUMN purchaseordernumber});
27
            $dbh->do(q{ALTER TABLE aqorders DROP COLUMN purchaseordernumber});
11
        }
28
        }
12
    },
29
    },
13
- 

Return to bug 36002