From 4d8ac89c0e082f2764d708b991764783d38987e3 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sat, 27 Oct 2018 13:21:09 +0000 Subject: [PATCH] Bug 18591: DBRev 18.06.00.046 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 19 +++++++++++-- Koha/Schema/Result/Illrequest.pm | 19 +++++++++++-- .../atomicupdate/bug18591-ill-comments.perl | 26 ------------------ installer/data/mysql/updatedatabase.pl | 27 +++++++++++++++++++ 5 files changed, 62 insertions(+), 31 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug18591-ill-comments.perl diff --git a/Koha.pm b/Koha.pm index 5e1983301a..b582f2beb1 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 = "18.06.00.045"; +$VERSION = "18.06.00.046"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 236c917912..8e4580f7e0 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1025,6 +1025,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illcomments + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illcomments", + "Koha::Schema::Result::Illcomment", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 illrequests Type: has_many @@ -1416,8 +1431,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-09-20 13:00:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QT6EPIG26F/kNK6prauRgw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-27 13:16:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c3Tb59Kku0Hh+tsVV5eCDg __PACKAGE__->belongs_to( "guarantor", diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 3e8462c13b..cc56ee16d5 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -223,6 +223,21 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +=head2 illcomments + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illcomments", + "Koha::Schema::Result::Illcomment", + { "foreign.illrequest_id" => "self.illrequest_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 illrequestattributes Type: has_many @@ -239,8 +254,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-01 02:46:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MMKr4JAAAsNnFcQn9SPTcw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-27 13:16:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rv6QyhxEah2r/rDcz3aOOw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug18591-ill-comments.perl b/installer/data/mysql/atomicupdate/bug18591-ill-comments.perl deleted file mode 100644 index 574211883a..0000000000 --- a/installer/data/mysql/atomicupdate/bug18591-ill-comments.perl +++ /dev/null @@ -1,26 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - unless (TableExists('illcomments')) { - $dbh->do(q{ - CREATE TABLE illcomments ( - illcomment_id int(11) NOT NULL AUTO_INCREMENT, -- Unique ID of the comment - illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number - borrowernumber integer DEFAULT NULL, -- Link to the user who made the comment (could be librarian, patron or ILL partner library) - comment text DEFAULT NULL, -- The text of the comment - timestamp timestamp DEFAULT CURRENT_TIMESTAMP, -- Date and time when the comment was made - PRIMARY KEY ( illcomment_id ), - CONSTRAINT illcomments_bnfk - FOREIGN KEY ( borrowernumber ) - REFERENCES borrowers ( borrowernumber ) - ON UPDATE CASCADE ON DELETE CASCADE, - CONSTRAINT illcomments_ifk - FOREIGN KEY (illrequest_id) - REFERENCES illrequests ( illrequest_id ) - ON UPDATE CASCADE ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 18591 - Add comments to ILL requests)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d3245a144c..f7af2a1875 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16714,6 +16714,33 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 21639 - Add phone transports by default)\n"; } +$DBversion = '18.06.00.046'; +if( CheckVersion( $DBversion ) ) { + unless (TableExists('illcomments')) { + $dbh->do(q{ + CREATE TABLE illcomments ( + illcomment_id int(11) NOT NULL AUTO_INCREMENT, -- Unique ID of the comment + illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number + borrowernumber integer DEFAULT NULL, -- Link to the user who made the comment (could be librarian, patron or ILL partner library) + comment text DEFAULT NULL, -- The text of the comment + timestamp timestamp DEFAULT CURRENT_TIMESTAMP, -- Date and time when the comment was made + PRIMARY KEY ( illcomment_id ), + CONSTRAINT illcomments_bnfk + FOREIGN KEY ( borrowernumber ) + REFERENCES borrowers ( borrowernumber ) + ON UPDATE CASCADE ON DELETE CASCADE, + CONSTRAINT illcomments_ifk + FOREIGN KEY (illrequest_id) + REFERENCES illrequests ( illrequest_id ) + ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18591 - Add comments to ILL requests)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.20.1