Bugzilla – Attachment 97114 Details for
Bug 24161
Add ability to track the claim dates of later orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24161: DB changes
Bug-24161-DB-changes.patch (text/plain), 4.00 KB, created by
Jonathan Druart
on 2020-01-09 16:32:19 UTC
(
hide
)
Description:
Bug 24161: DB changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-01-09 16:32:19 UTC
Size:
4.00 KB
patch
obsolete
>From 7b0ea1669b9bba2cd57f377d5ffd35079a30506c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Dec 2019 17:20:31 +0100 >Subject: [PATCH] Bug 24161: DB changes > >Sponsored-by: Cork Institute of Technology >--- > installer/data/mysql/atomicupdate/bug_24161.perl | 36 ++++++++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 14 +++++++-- > 2 files changed, 48 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_24161.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_24161.perl b/installer/data/mysql/atomicupdate/bug_24161.perl >new file mode 100644 >index 0000000000..fd64ec99d5 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24161.perl >@@ -0,0 +1,36 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ unless ( TableExists( 'aqorders_claims' ) ) { >+ $dbh->do(q| >+ CREATE TABLE aqorders_claims ( >+ id int(11) AUTO_INCREMENT, >+ ordernumber INT(11) NOT NULL, >+ claimed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, >+ PRIMARY KEY (id), >+ CONSTRAINT aqorders_claims_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci >+ |); >+ >+ my $orders = $dbh->selectall_arrayref(q| >+ SELECT ordernumber, claims_count, claimed_date >+ FROM aqorders >+ WHERE claims_count > 0 >+ |, { Slice => {} }); >+ my $insert_claim_sth = $dbh->prepare(q| >+ INSERT INTO aqorders_claims (ordernumber, claimed_on) >+ VALUES (?,?) >+ |); >+ >+ for my $order ( @$orders ) { >+ for my $claim (1..$order->{claims_count}) { >+ $insert_claim_sth->execute($order->{ordernumber}, $order->{claimed_on}); >+ } >+ } >+ >+ $dbh->do(q|ALTER TABLE aqorders DROP COLUMN claims_count, DROP COLUMN claimed_date|); >+ } >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c702d405a0..01d3a8a011 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3211,8 +3211,6 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items > `sort1_authcat` varchar(10) default NULL, > `sort2_authcat` varchar(10) default NULL, > `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no) >- `claims_count` int(11) default 0, -- count of claim letters generated >- `claimed_date` date default NULL, -- last date a claim was generated > `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid) > parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent > `orderstatus` varchar(16) default 'new', -- the current status for this line item. Can be 'new', 'ordered', 'partial', 'complete' or 'cancelled' >@@ -3277,6 +3275,18 @@ CREATE TABLE aqorders_transfers ( > CONSTRAINT aqorders_transfers_ordernumber_to FOREIGN KEY (ordernumber_to) REFERENCES aqorders (ordernumber) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >+-- >+-- Table structure for table aqorders_claims >+-- >+ >+DROP TABLE IF EXISTS aqorders_claims; >+CREATE TABLE aqorders_claims ( >+ id int(11) AUTO_INCREMENT, >+ ordernumber INT(11) NOT NULL, >+ claimed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, >+ PRIMARY KEY (id), >+ CONSTRAINT aqorders_claims_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; > > -- > -- Table structure for table `transport_cost` >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24161
:
97114
|
97115
|
97116
|
97117
|
97118
|
97119
|
97470
|
97471
|
97472
|
98280
|
98522
|
98523
|
98524
|
98525
|
98526
|
98527
|
102111
|
102112
|
102113
|
102114
|
102115
|
102116
|
102220
|
102222
|
103567
|
103568
|
103569
|
103570
|
103571
|
103588
|
103589
|
103590
|
103591
|
103592
|
103593
|
103594
|
103595
|
104190
|
104191
|
104207
|
104208
|
104209
|
104210
|
104211
|
104212
|
104213
|
104214
|
104215
|
104216
|
104258
|
104259
|
104265
|
104826
|
104848