Browse Source
This patch makes the atomic update use the new functions introduced by bug 17234 for checking the structure before attempting to call ALTER TABLE. It checks for the column existence, and also if it is a primary key. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>17.05.x
2 changed files with 14 additions and 11 deletions
@ -0,0 +1,14 @@ |
|||
$DBversion = "16.12.00.XXX"; |
|||
if ( CheckVersion($DBversion) ) { |
|||
unless ( column_exists( 'borrower_attributes', 'id' ) |
|||
and index_exists( 'borrower_attributes', 'PRIMARY' ) ) |
|||
{ |
|||
$dbh->do(q{ |
|||
ALTER TABLE `borrower_attributes` |
|||
ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST |
|||
}); |
|||
} |
|||
|
|||
print "Upgrade to $DBversion done (Bug 17813: Table borrower_attributes needs a primary key\n"; |
|||
SetVersion($DBversion); |
|||
} |
@ -1,11 +0,0 @@ |
|||
ALTER TABLE `borrower_attributes` ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; |
|||
|
|||
-- $DBversion = "16.12.00.XXX"; |
|||
-- if(CheckVersion($DBversion)) { |
|||
-- $dbh->do(q{ |
|||
-- ALTER TABLE `borrower_attributes` ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST |
|||
-- }); |
|||
-- |
|||
-- print "Upgrade to $DBversion done (Bug 17813: Table borrower_attributes needs a primary key\n"; |
|||
-- SetVersion ($DBversion); |
|||
-- } |
Loading…
Reference in new issue