From 71a115221c9fdae2571193182bc9858e9b77ce88 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Thu, 4 May 2023 11:03:30 +0000 Subject: [PATCH] Bug 33262: Add deleted_biblionumber column to aqorders table This adds a new column deleted_biblionumber to the aqorders table. This will allow us to store the biblionumber of a deleted record, so we will still be able to tell what has been ordered once the record is deleted. --- Koha/Schema/Result/Aqorder.pm | 13 ++++++++++-- .../data/mysql/atomicupdate/bug_33262.pl | 20 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33262.pl diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm index d11d6d12fe..1a71858661 100644 --- a/Koha/Schema/Result/Aqorder.pm +++ b/Koha/Schema/Result/Aqorder.pm @@ -39,6 +39,13 @@ primary key and unique identifier assigned by Koha to each line links the order to the biblio being ordered (biblio.biblionumber) +=head2 deleted_biblionumber + + data_type: 'integer' + is_nullable: 1 + +links the order to the deleted bibliographic record deletedbiblio.biblionumber) + =head2 entrydate data_type: 'date' @@ -438,6 +445,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "biblionumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "deleted_biblionumber", + { data_type => "integer", is_nullable => 1 }, "entrydate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "quantity", @@ -805,8 +814,8 @@ Composing rels: L -> borrowernumber __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-06 16:45:06 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7vMNLDNO0/Bpng9sBFyyBg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-04 11:17:35 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VtBQdGGCN86D4CWZLMZX+g __PACKAGE__->belongs_to( "basket", diff --git a/installer/data/mysql/atomicupdate/bug_33262.pl b/installer/data/mysql/atomicupdate/bug_33262.pl new file mode 100755 index 0000000000..b570526193 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33262.pl @@ -0,0 +1,20 @@ +use Modern::Perl; + +return { + bug_number => "33262", + description => "Store biblionumber of deleted record in acquisition orders", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + if ( !column_exists( 'aqorders', 'deleted_biblionumber' ) ) { + + $dbh->do( + q{ + ALTER TABLE `aqorders` + ADD COLUMN `deleted_biblionumber` int(11) NULL DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)' AFTER biblionumber + } + ); + } + say $out "Added column 'aqorders.deleted_biblionumber'"; + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 50796112dc..ee32e9d33c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -659,6 +659,7 @@ DROP TABLE IF EXISTS `aqorders`; CREATE TABLE `aqorders` ( `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line', `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)', + `deleted_biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)', `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket', `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered', `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase', -- 2.30.2