Bug 12267: Remove borrower_attributes.password
[koha.git] / installer / data / mysql / atomicupdate / bug_12267.perl
1 my $dbh = C4::Context->dbh;
2 my ( $column_has_been_used ) = $dbh->selectrow_array(q|
3     SELECT COUNT(*)
4     FROM borrower_attributes
5     WHERE password IS NOT NULL
6 |);
7
8 if ( $column_has_been_used ) {
9     warn q|WARNING: The columns borrower_attribute_types.password_allowed and borrower_attributes.column have been removed from the Koha codebase. There were not used. However your installation has at least 1 borrower_attributes.password defined. In order not to alter your data, the columns have been kept, please remove them manually if you do not use them this feature.|;
10 } else {
11     $dbh->do(q|
12         ALTER TABLE borrower_attribute_types DROP column password_allowed
13     |);
14     $dbh->do(q|
15         ALTER TABLE borrower_attributes DROP column password;
16     |);
17 }