From 21594689e54abdf9b07669a0b1b35f204eb2bd1e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 5 Feb 2020 14:26:47 +0000 Subject: [PATCH] Bug 23673: DBRev 19.12.00.019 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- Koha/Schema/Result/MessageQueue.pm | 16 ++++++++++++++-- installer/data/mysql/atomicupdate/bug-23673.perl | 13 ------------- installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 16 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug-23673.perl diff --git a/Koha.pm b/Koha.pm index c27e9596e5..92944fa088 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 = "19.12.00.018"; +$VERSION = "19.12.00.019"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/MessageQueue.pm b/Koha/Schema/Result/MessageQueue.pm index 08b602882b..c8d0d5a2c3 100644 --- a/Koha/Schema/Result/MessageQueue.pm +++ b/Koha/Schema/Result/MessageQueue.pm @@ -72,6 +72,12 @@ __PACKAGE__->table("message_queue"); =head2 time_queued + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 updated_on + data_type: 'timestamp' datetime_undef_if_invalid: 1 default_value: current_timestamp @@ -117,6 +123,12 @@ __PACKAGE__->add_columns( is_nullable => 0, }, "time_queued", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "updated_on", { data_type => "timestamp", datetime_undef_if_invalid => 1, @@ -181,8 +193,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9u39S/GLtZwnZGp+xcZOBA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-05 14:26:34 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fSWIVVJGliKtqQaNbmZKYQ sub koha_object_class { 'Koha::Notice::Message'; diff --git a/installer/data/mysql/atomicupdate/bug-23673.perl b/installer/data/mysql/atomicupdate/bug-23673.perl deleted file mode 100644 index faa5a88e8d..0000000000 --- a/installer/data/mysql/atomicupdate/bug-23673.perl +++ /dev/null @@ -1,13 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - $dbh->do("ALTER TABLE message_queue MODIFY time_queued timestamp NULL"); - - if( !column_exists( 'message_queue', 'updated_on' ) ) { - $dbh->do("ALTER TABLE message_queue ADD COLUMN updated_on timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER time_queued"); - $dbh->do("UPDATE message_queue SET updated_on=time_queued"); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3f17b16baf..1378afc08f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20732,6 +20732,20 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 18936: Convert issuingrules fields to circulation_rules)\n"; } +$DBversion = '19.12.00.019'; +if( CheckVersion( $DBversion ) ) { + + $dbh->do("ALTER TABLE message_queue MODIFY time_queued timestamp NULL"); + + if( !column_exists( 'message_queue', 'updated_on' ) ) { + $dbh->do("ALTER TABLE message_queue ADD COLUMN updated_on timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER time_queued"); + $dbh->do("UPDATE message_queue SET updated_on=time_queued"); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5