Bugzilla – Attachment 102655 Details for
Bug 25037
Add checkout_type to checkouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25037: Convert issues.onsite_checkout to issues.checkout_type
Bug-25037-Convert-issuesonsitecheckout-to-issuesch.patch (text/plain), 5.92 KB, created by
Lari Taskula
on 2020-04-09 19:47:58 UTC
(
hide
)
Description:
Bug 25037: Convert issues.onsite_checkout to issues.checkout_type
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-04-09 19:47:58 UTC
Size:
5.92 KB
patch
obsolete
>From ec2256246285209cf34f1cdc158a8bc90428cfc3 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Wed, 1 Apr 2020 17:28:11 +0000 >Subject: [PATCH] Bug 25037: Convert issues.onsite_checkout to > issues.checkout_type > >If onsite_checkout=1, checkout_type becomes "ONSITE" >Else checkout_type becomes "CHECKOUT" > >To test: >1. perl installer/data/mysql/updatedatabase.pl > >Sponsored-by: The National Library of Finland >--- > ...vert_onsite_checkout_to_checkout_type.perl | 50 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 7 +-- > 2 files changed, 54 insertions(+), 3 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_25037_2_convert_onsite_checkout_to_checkout_type.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_25037_2_convert_onsite_checkout_to_checkout_type.perl b/installer/data/mysql/atomicupdate/bug_25037_2_convert_onsite_checkout_to_checkout_type.perl >new file mode 100644 >index 0000000000..73d1334dfe >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_25037_2_convert_onsite_checkout_to_checkout_type.perl >@@ -0,0 +1,50 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ # ISSUES >+ # Convert issues.onsite_checkout to checkout_type => 'CHECKOUT' / 'ONSITE' >+ if ( ! column_exists( 'issues', 'checkout_type' ) ) { >+ $dbh->do( q| >+ ALTER TABLE issues ADD COLUMN checkout_type ENUM('CHECKOUT', 'ONSITE') NOT NULL DEFAULT 'CHECKOUT' AFTER onsite_checkout; >+ | ); >+ } >+ if ( column_exists( 'issues', 'onsite_checkout' ) && column_exists( 'issues', 'checkout_type' ) ) { >+ $dbh->do( q| >+ UPDATE issues SET checkout_type='CHECKOUT' WHERE onsite_checkout<>1; >+ | ); >+ $dbh->do( q| >+ UPDATE issues SET checkout_type='ONSITE' WHERE onsite_checkout=1; >+ | ); >+ } >+ if ( column_exists( 'issues', 'onsite_checkout' ) ) { >+ $dbh->do( q| >+ ALTER TABLE issues DROP COLUMN onsite_checkout; >+ | ); >+ } >+ >+ # OLD_ISSUES >+ # Convert old_issues.onsite_checkout to checkout_type => 'CHECKOUT' / 'ONSITE' >+ if ( ! column_exists( 'old_issues', 'checkout_type' ) ) { >+ $dbh->do( q| >+ ALTER TABLE old_issues ADD COLUMN checkout_type ENUM('CHECKOUT', 'ONSITE') NOT NULL DEFAULT 'CHECKOUT' AFTER onsite_checkout; >+ | ); >+ } >+ if ( column_exists( 'old_issues', 'onsite_checkout' ) && column_exists( 'old_issues', 'checkout_type' ) ) { >+ $dbh->do( q| >+ UPDATE old_issues SET checkout_type='CHECKOUT' WHERE onsite_checkout<>1; >+ | ); >+ $dbh->do( q| >+ UPDATE old_issues SET checkout_type='ONSITE' WHERE onsite_checkout=1; >+ | ); >+ } >+ if ( column_exists( 'old_issues', 'onsite_checkout' ) ) { >+ $dbh->do( q| >+ ALTER TABLE old_issues DROP COLUMN onsite_checkout; >+ | ); >+ } >+ >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 25037 - Convert issues.onsite_checkout to issues.checkout_type column)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index af10ac5317..68ad01f9bb 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1638,7 +1638,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched > `issuedate` datetime default NULL, -- date the item was checked out or issued >- `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag >+ `checkout_type` ENUM('CHECKOUT', 'ONSITE') NOT NULL default 'CHECKOUT', -- checkout type > `note` LONGTEXT default NULL, -- issue note text > `notedate` datetime default NULL, -- datetime of issue note (yyyy-mm-dd hh:mm::ss) > `noteseen` int(1) default NULL, -- describes whether checkout note has been seen 1, not been seen 0 or doesn't exist null >@@ -1649,7 +1649,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > KEY `branchcode_idx` (`branchcode`), > KEY `bordate` (`borrowernumber`,`timestamp`), > CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, >- CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE >+ CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE, > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >@@ -1670,7 +1670,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r > `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched > `issuedate` datetime default NULL, -- date the item was checked out or issued >- `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag >+ `checkout_type` ENUM('CHECKOUT', 'ONSITE') NOT NULL default 'CHECKOUT', -- checkout type > `note` LONGTEXT default NULL, -- issue note text > `notedate` datetime default NULL, -- datetime of issue note (yyyy-mm-dd hh:mm::ss) > `noteseen` int(1) default NULL, -- describes whether checkout note has been seen 1, not been seen 0 or doesn't exist null >@@ -1683,6 +1683,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r > ON DELETE SET NULL ON UPDATE SET NULL, > CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) > ON DELETE SET NULL ON UPDATE SET NULL >+ > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >-- >2.17.1
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 25037
:
102259
|
102260
|
102261
|
102262
|
102263
|
102264
|
102265
|
102266
|
102267
|
102268
|
102269
|
102272
|
102413
|
102414
|
102415
|
102416
|
102417
|
102418
|
102419
|
102420
|
102421
|
102422
|
102423
|
102424
|
102586
|
102587
|
102588
|
102589
|
102590
|
102591
|
102592
|
102593
|
102594
|
102595
|
102596
|
102597
|
102598
|
102599
|
102655
|
102656
|
102657
|
102658
|
102659
|
102660
|
102661
|
102662
|
102663
|
102664
|
102665
|
102666
|
102675
|
102676
|
104267
|
104268
|
105638
|
105780
|
105781
|
105782
|
105783
|
105784