@@ -, +, @@ --- installer/data/mysql/atomicupdate/bug_28844.pl | 18 ++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_28844.pl --- a/installer/data/mysql/atomicupdate/bug_28844.pl +++ a/installer/data/mysql/atomicupdate/bug_28844.pl @@ -0,0 +1,18 @@ +use Modern::Perl; + +return { + bug_number => "28844", + description => "Link orders and suggestions", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless ( column_exists('aqorders', 'suggestionid') ) { + $dbh->do(q{ + ALTER TABLE aqorders + ADD COLUMN `suggestionid` int(11) DEFAULT NULL COMMENT 'links this order line to a suggestion (suggestion.suggestionid)' AFTER subscriptionid, + ADD CONSTRAINT `aqorders_suggestionid` FOREIGN KEY (`suggestionid`) REFERENCES `suggestions` (`suggestionid`) ON DELETE SET NULL ON UPDATE CASCADE + }); + say $out "Added column 'aqorders.suggestionid'"; + } + }, +}; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -763,6 +763,7 @@ CREATE TABLE `aqorders` ( `sort2_authcat` varchar(10) DEFAULT NULL, `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)', `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)', + `suggestionid` int(11) DEFAULT NULL COMMENT 'links this order line to a suggestion (suggestion.suggestionid)', `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent', `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''', `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline', @@ -790,7 +791,8 @@ CREATE TABLE `aqorders` ( CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL, - CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `aqorders_suggestionid` FOREIGN KEY (`suggestionid`) REFERENCES `suggestions` (`suggestionid`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --