Bug 17813: (QA followup) Properly check DB structure before altering it
[koha.git] / installer / data / mysql / atomicupdate / bug_17813_borrower_attributes_pk.perl
1 $DBversion = "16.12.00.XXX";
2 if ( CheckVersion($DBversion) ) {
3     unless (     column_exists( 'borrower_attributes', 'id' )
4              and index_exists( 'borrower_attributes', 'PRIMARY' ) )
5     {
6         $dbh->do(q{
7             ALTER TABLE `borrower_attributes`
8                 ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
9         });
10     }
11
12     print "Upgrade to $DBversion done (Bug 17813: Table borrower_attributes needs a primary key\n";
13     SetVersion($DBversion);
14 }