Bug 14187: (QA followup) Properly check DB structure before altering it
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
292b9df914
commit
ac3e4ce671
|
|
@ -1,8 +1,15 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
$dbh->do("ALTER TABLE branchtransfers ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);");
|
||||
$DBversion = '16.12.00.XXX';
|
||||
if ( CheckVersion($DBversion) ) {
|
||||
unless (column_exists( 'branchtransfers', 'branchtransfer_id' )
|
||||
and index_exists( 'branchtransfers', 'PRIMARY' ) )
|
||||
{
|
||||
$dbh->do(
|
||||
"ALTER TABLE branchtransfers
|
||||
ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);"
|
||||
);
|
||||
}
|
||||
|
||||
# Always end with this (adjust the bug info)
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 14187 - branchtransfer needs a primary key (id) for DBIx and common sense.)\n";
|
||||
SetVersion($DBversion);
|
||||
print "Upgrade to $DBversion done (Bug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.)\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue