From 00bfa63dc7cb8322045690745e818dbd05dcbe64 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 18 Feb 2018 16:47:12 -0300 Subject: [PATCH] Bug 17672: DBRev 17.12.00.017 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- ...bug17672_add_damaged_on_column_to_items.perl | 9 --------- installer/data/mysql/updatedatabase.pl | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 11 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl diff --git a/Koha.pm b/Koha.pm index c618fdc236..6aeb766b70 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "17.12.00.016"; +$VERSION = "17.12.00.017"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl b/installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl deleted file mode 100644 index 7e6348a600..0000000000 --- a/installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl +++ /dev/null @@ -1,9 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( "ALTER TABLE items ADD COLUMN damaged_on DATETIME NULL AFTER damaged"); - $dbh->do( "ALTER TABLE deleteditems ADD COLUMN damaged_on DATETIME NULL AFTER damaged"); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 17672: Add damaged_on to items and deleteditems tables)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f0733da8fd..b5a84edda6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -15543,10 +15543,25 @@ if( CheckVersion( $DBversion ) ) { } $dbh->do(q|SET foreign_key_checks = 1|); - print "Upgrade to $DBversion done (Bug 18336: Convert DB tables to utf8mb4 💩)\n"; + print "Upgrade to $DBversion done (Bug 18336 - Convert DB tables to utf8mb4 💩)\n"; SetVersion($DBversion); } + +$DBversion = '17.12.00.017'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'items', 'damaged_on' ) ) { + $dbh->do( "ALTER TABLE items ADD COLUMN damaged_on DATETIME NULL AFTER damaged"); + } + if( !column_exists( 'deleteditems', 'damaged_on' ) ) { + $dbh->do( "ALTER TABLE deleteditems ADD COLUMN damaged_on DATETIME NULL AFTER damaged"); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17672 - Add damaged_on to items and deleteditems tables)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.20.1