From 7073d977a244fdb27975167f055edb5c336c3ce6 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. Test plan in last patch. --- .../data/mysql/atomicupdate/bug_33262.pl | 20 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 21 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_33262.pl diff --git a/installer/data/mysql/atomicupdate/bug_33262.pl b/installer/data/mysql/atomicupdate/bug_33262.pl new file mode 100755 index 0000000000..3acafc8cfb --- /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..1147d34132 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