Bugzilla – Attachment 92674 Details for
Bug 19618
Add 'Club Holds' feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19618: Add club_holds and club_holds_to_patron_holds tables
Bug-19618-Add-clubholds-and-clubholdstopatronholds.patch (text/plain), 6.39 KB, created by
Agustín Moyano
on 2019-09-10 07:11:35 UTC
(
hide
)
Description:
Bug 19618: Add club_holds and club_holds_to_patron_holds tables
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-09-10 07:11:35 UTC
Size:
6.39 KB
patch
obsolete
>From faf062551e052b115ea0f75ca19f9ca8072e1e25 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Thu, 5 Sep 2019 14:13:36 -0300 >Subject: [PATCH] Bug 19618: Add club_holds and club_holds_to_patron_holds > tables > >This patch adds 2 new tables >1. club_holds >2. club_holds_to_patron_holds > >They are ment to keep info about hold requests made in name of a club > >To test: >1) apply this patch >2) perl installer/data/mysql/updatedatabase.pl >SUCCESS => 2 new tables were created >--- > .../data/mysql/atomicupdate/club_holds.perl | 42 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 39 +++++++++++++++++ > 2 files changed, 81 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/club_holds.perl > >diff --git a/installer/data/mysql/atomicupdate/club_holds.perl b/installer/data/mysql/atomicupdate/club_holds.perl >new file mode 100644 >index 0000000000..e92789c7ba >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/club_holds.perl >@@ -0,0 +1,42 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ $dbh->do(q| >+ CREATE TABLE IF NOT EXISTS club_holds ( >+ id INT(11) NOT NULL AUTO_INCREMENT, >+ club_id INT(11) NOT NULL, -- id for the club the hold was generated for >+ biblio_id INT(11) NOT NULL, -- id for the bibliographic record the hold has been placed against >+ item_id INT(11) NULL DEFAULT NULL, -- If item-level, the id for the item the hold has been placed agains >+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Timestamp for the placed hold >+ PRIMARY KEY (id), >+ -- KEY club_id (club_id), >+ CONSTRAINT clubs_holds_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_ibfk_3 FOREIGN KEY (item_id) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ |); >+ >+ $dbh->do(q| >+ CREATE TABLE IF NOT EXISTS club_holds_to_patron_holds ( >+ id INT(11) NOT NULL AUTO_INCREMENT, >+ club_hold_id INT(11) NOT NULL, >+ patron_id INT(11) NOT NULL, >+ hold_id INT(11), >+ error_code ENUM ( 'damaged', 'ageRestricted', 'itemAlreadyOnHold', >+ 'tooManyHoldsForThisRecord', 'tooManyReservesToday', >+ 'tooManyReserves', 'notReservable', 'cannotReserveFromOtherBranches', >+ 'libraryNotFound', 'libraryNotPickupLocation', 'cannotBeTransferred' >+ ) NULL DEFAULT NULL, >+ error_message varchar(100) NULL DEFAULT NULL, >+ PRIMARY KEY (id), >+ -- KEY club_hold_id (club_hold_id), >+ CONSTRAINT clubs_holds_paton_holds_ibfk_1 FOREIGN KEY (club_hold_id) REFERENCES club_holds (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_paton_holds_ibfk_2 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_paton_holds_ibfk_3 FOREIGN KEY (hold_id) REFERENCES reserves (reserve_id) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ |); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 19618 - add club_holds tables)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 673f83ee57..a8ee231ce9 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3985,6 +3985,45 @@ CREATE TABLE IF NOT EXISTS clubs ( > CONSTRAINT clubs_ibfk_2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >+-- >+-- Table structure for table 'club_holds' >+-- >+ >+CREATE TABLE IF NOT EXISTS club_holds ( >+ id INT(11) NOT NULL AUTO_INCREMENT, >+ club_id INT(11) NOT NULL, -- id for the club the hold was generated for >+ biblio_id INT(11) NOT NULL, -- id for the bibliographic record the hold has been placed against >+ item_id INT(11) NULL DEFAULT NULL, -- If item-level, the id for the item the hold has been placed agains >+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Timestamp for the placed hold >+ PRIMARY KEY (id), >+ -- KEY club_id (club_id), >+ CONSTRAINT clubs_holds_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_ibfk_3 FOREIGN KEY (item_id) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ >+-- >+-- Table structure for table 'club_holds_to_patron_holds' >+-- >+ >+CREATE TABLE IF NOT EXISTS club_holds_to_patron_holds ( >+ id INT(11) NOT NULL AUTO_INCREMENT, >+ club_hold_id INT(11) NOT NULL, >+ patron_id INT(11) NOT NULL, >+ hold_id INT(11), >+ error_code ENUM ( 'damaged', 'ageRestricted', 'itemAlreadyOnHold', >+ 'tooManyHoldsForThisRecord', 'tooManyReservesToday', >+ 'tooManyReserves', 'notReservable', 'cannotReserveFromOtherBranches', >+ 'libraryNotFound', 'libraryNotPickupLocation', 'cannotBeTransferred' >+ ) NULL DEFAULT NULL, >+ error_message varchar(100) NULL DEFAULT NULL, >+ PRIMARY KEY (id), >+ -- KEY club_hold_id (club_hold_id), >+ CONSTRAINT clubs_holds_paton_holds_ibfk_1 FOREIGN KEY (club_hold_id) REFERENCES club_holds (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_paton_holds_ibfk_2 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT clubs_holds_paton_holds_ibfk_3 FOREIGN KEY (hold_id) REFERENCES reserves (reserve_id) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ > -- > -- Table structure for table 'club_enrollments' > -- >-- >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 19618
:
92674
|
92675
|
92676
|
92677
|
92678
|
92746
|
92747
|
92748
|
92749
|
92750
|
92751
|
93253
|
93254
|
93255
|
93256
|
93257
|
93258