Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
|
3 |
use Term::ANSIColor qw(:constants); |
4 |
|
5 |
return { |
6 |
bug_number => "35539", |
7 |
description => "Remove unused columns from 'categories' table", |
8 |
up => sub { |
9 |
my ($args) = @_; |
10 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
11 |
|
12 |
if ( column_exists( 'categories', 'bulk' ) ) { |
13 |
my ($bulkdata) = $dbh->selectrow_array( |
14 |
q| |
15 |
SELECT bulk FROM categories; |
16 |
| |
17 |
); |
18 |
if ($bulkdata) { |
19 |
say $out YELLOW, |
20 |
"Data was found in 'bulk' column in 'categories' table. Please remove this data and run the update again."; |
21 |
} else { |
22 |
$dbh->do("ALTER TABLE categories DROP COLUMN bulk"); |
23 |
say $out "Removed 'bulk' column from 'categories' table"; |
24 |
} |
25 |
} |
26 |
|
27 |
if ( column_exists( 'categories', 'finetype' ) ) { |
28 |
my ($bulkdata) = $dbh->selectrow_array( |
29 |
q| |
30 |
SELECT finetype FROM categories; |
31 |
| |
32 |
); |
33 |
if ($bulkdata) { |
34 |
say $out YELLOW, |
35 |
"Data was found in 'finetype' column in 'categories' table. Please remove this data and run the update again."; |
36 |
} else { |
37 |
$dbh->do("ALTER TABLE categories DROP COLUMN finetype"); |
38 |
say $out "Removed 'finetype' column from 'categories' table"; |
39 |
} |
40 |
} |
41 |
|
42 |
if ( column_exists( 'categories', 'issuelimit' ) ) { |
43 |
my ($bulkdata) = $dbh->selectrow_array( |
44 |
q| |
45 |
SELECT issuelimit FROM categories; |
46 |
| |
47 |
); |
48 |
if ($bulkdata) { |
49 |
say $out YELLOW, |
50 |
"Data was found in 'issuelimit' column in 'categories' table. Please remove this data and run the update again."; |
51 |
} else { |
52 |
$dbh->do("ALTER TABLE categories DROP COLUMN issuelimit"); |
53 |
say $out "Removed 'issuelimit' column from 'categories' table"; |
54 |
} |
55 |
} |
56 |
|
57 |
say $out WHITE, "Bug 35539: All done."; |
58 |
}, |
59 |
}; |