Bug 14187: (QA followup) Properly check DB structure before altering it
[koha.git] / installer / data / mysql / atomicupdate / 14187.perl
1 $DBversion = '16.12.00.XXX';
2 if ( CheckVersion($DBversion) ) {
3     unless (column_exists( 'branchtransfers', 'branchtransfer_id' )
4         and index_exists( 'branchtransfers', 'PRIMARY' ) )
5     {
6         $dbh->do(
7             "ALTER TABLE branchtransfers
8                  ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);"
9         );
10     }
11
12     # Always end with this (adjust the bug info)
13     SetVersion($DBversion);
14     print "Upgrade to $DBversion done (Bug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.)\n";
15 }