Bugzilla – Attachment 113379 Details for
Bug 23916
Issuer should be recorded and visible in patron circulation history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23916: (QA follow-up) Rename issuer => issuer_id [DB]
Bug-23916-QA-follow-up-Rename-issuer--issuerid-DB.patch (text/plain), 10.97 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-11-10 12:00:46 UTC
(
hide
)
Description:
Bug 23916: (QA follow-up) Rename issuer => issuer_id [DB]
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-11-10 12:00:46 UTC
Size:
10.97 KB
patch
obsolete
>From de106c0e7eba7fb23bdc22f01ac7299f576287bc Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 10 Nov 2020 08:46:18 -0300 >Subject: [PATCH] Bug 23916: (QA follow-up) Rename issuer => issuer_id [DB] > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Schema/Result/Borrower.pm | 34 +++++++++++++++++-- > Koha/Schema/Result/Issue.pm | 32 +++++++++++++++-- > Koha/Schema/Result/OldIssue.pm | 32 +++++++++++++++-- > .../bug_23916_add_issues_issuer.perl | 11 +++--- > installer/data/mysql/kohastructure.sql | 8 ++--- > 5 files changed, 101 insertions(+), 16 deletions(-) > >diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm >index 8c2dcc20c67..08f974d0ff5 100644 >--- a/Koha/Schema/Result/Borrower.pm >+++ b/Koha/Schema/Result/Borrower.pm >@@ -1157,6 +1157,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 issues_issuers >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::Issue> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "issues_issuers", >+ "Koha::Schema::Result::Issue", >+ { "foreign.issuer_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 items_last_borrowers > > Type: has_many >@@ -1232,6 +1247,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 old_issues_issuers >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::OldIssue> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "old_issues_issuers", >+ "Koha::Schema::Result::OldIssue", >+ { "foreign.issuer_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 old_reserves > > Type: has_many >@@ -1683,8 +1713,8 @@ Composing rels: L</aqorder_users> -> ordernumber > __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-10-08 14:17:29 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kzx7ildKCEFF6YDr6MRCrw >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-11-09 19:12:25 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Kp53XFs7tFIpzNSqm/WY8w > > __PACKAGE__->add_columns( > '+anonymized' => { is_boolean => 1 }, >diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm >index 5ffba8af90f..0c960144aea 100644 >--- a/Koha/Schema/Result/Issue.pm >+++ b/Koha/Schema/Result/Issue.pm >@@ -35,6 +35,12 @@ __PACKAGE__->table("issues"); > is_foreign_key: 1 > is_nullable: 1 > >+=head2 issuer_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ > =head2 itemnumber > > data_type: 'integer' >@@ -125,6 +131,8 @@ __PACKAGE__->add_columns( > { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, > "borrowernumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "issuer_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "itemnumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "date_due", >@@ -228,6 +236,26 @@ __PACKAGE__->belongs_to( > }, > ); > >+=head2 issuer >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "issuer", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "issuer_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ > =head2 itemnumber > > Type: belongs_to >@@ -264,8 +292,8 @@ __PACKAGE__->might_have( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-31 12:18:38 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QVmFa5b0Pe5OhUI92n9kzQ >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-11-09 19:12:26 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z0qpsT632VLwejUFjIO/ag > > __PACKAGE__->add_columns( > '+auto_renew' => { is_boolean => 1 }, >diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm >index 6e5b6e81b33..c0271b35290 100644 >--- a/Koha/Schema/Result/OldIssue.pm >+++ b/Koha/Schema/Result/OldIssue.pm >@@ -34,6 +34,12 @@ __PACKAGE__->table("old_issues"); > is_foreign_key: 1 > is_nullable: 1 > >+=head2 issuer_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ > =head2 itemnumber > > data_type: 'integer' >@@ -124,6 +130,8 @@ __PACKAGE__->add_columns( > { data_type => "integer", is_nullable => 0 }, > "borrowernumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "issuer_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "itemnumber", > { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, > "date_due", >@@ -213,6 +221,26 @@ __PACKAGE__->belongs_to( > }, > ); > >+=head2 issuer >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "issuer", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "issuer_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ > =head2 itemnumber > > Type: belongs_to >@@ -234,8 +262,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E2N2paWcCHg916100ry+2A >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-11-09 19:12:26 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jlgsHwZKoVn/HJD1NP1gqg > > __PACKAGE__->add_columns( > '+auto_renew' => { is_boolean => 1 }, >diff --git a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl b/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl >index 08ede0aa745..d3d2095f53c 100644 >--- a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl >+++ b/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl >@@ -1,18 +1,17 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > if( !column_exists( 'issues', 'issuer' ) ) { >- $dbh->do( q| ALTER TABLE issues ADD issuer INT(11) DEFAULT NULL AFTER borrowernumber | ); >+ $dbh->do( q| ALTER TABLE issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); > } > if (!foreign_key_exists( 'issues', 'issues_ibfk_borrowers_borrowernumber' )) { >- $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); >+ $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); > } > if( !column_exists( 'old_issues', 'issuer' ) ) { >- $dbh->do( q| ALTER TABLE old_issues ADD issuer INT(11) DEFAULT NULL AFTER borrowernumber | ); >+ $dbh->do( q| ALTER TABLE old_issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); > } > if (!foreign_key_exists( 'old_issues', 'old_issues_ibfk_borrowers_borrowernumber' )) { >- $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); >+ $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23916 - Add issues.issuer)\n"; >+ NewVersion( $DBversion, 23916, "Add issues.issuer"; > } >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 6087b42159a..fbf442ad764 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1618,7 +1618,7 @@ DROP TABLE IF EXISTS `issues`; > CREATE TABLE `issues` ( -- information related to check outs or issues > `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table > `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to >- `issuer` int(11) default NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item >+ `issuer_id` INT(11) NULL DEFAULT NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item > `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out > `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) > `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out >@@ -1641,7 +1641,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > 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_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE >+ CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >@@ -1652,7 +1652,7 @@ DROP TABLE IF EXISTS `old_issues`; > CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned > `issue_id` int(11) NOT NULL, -- primary key for issues table > `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to >- `issuer` int(11) default NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item >+ `issuer_id` INT(11) NULL DEFAULT NULL, -- foreign key, linking this to the borrowers table for the user who checked out this item > `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out > `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) > `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out >@@ -1676,7 +1676,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, >- CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer`) REFERENCES `borrowers` (`borrowernumber`) >+ CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) > ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >-- >2.29.2
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 23916
:
94914
|
94915
|
94916
|
94917
|
94918
|
95503
|
95504
|
95505
|
95506
|
95507
|
95508
|
95509
|
97719
|
97720
|
97721
|
97722
|
97723
|
97724
|
98586
|
98587
|
98588
|
98589
|
98590
|
98591
|
98594
|
99886
|
99887
|
99888
|
99889
|
99890
|
99891
|
110649
|
110650
|
110651
|
110652
|
110653
|
110654
|
110655
|
111485
|
111486
|
111487
|
111488
|
111489
|
111490
|
111491
|
111492
|
111966
|
111967
|
111968
|
111969
|
111970
|
111971
|
111972
|
111973
|
111974
|
112248
|
112249
|
112250
|
112251
|
112252
|
112253
|
112254
|
112255
|
112256
|
112257
|
112363
|
112364
|
112365
|
112366
|
112367
|
112368
|
112369
|
112370
|
112371
|
112372
|
112373
|
113035
|
113036
|
113037
|
113038
|
113039
|
113040
|
113041
|
113042
|
113043
|
113044
|
113045
|
113316
|
113317
|
113318
|
113319
|
113320
|
113321
|
113322
|
113323
|
113324
|
113325
|
113326
|
113327
|
113367
|
113368
|
113369
|
113370
|
113371
|
113372
|
113373
|
113374
|
113375
|
113376
|
113377
|
113378
| 113379 |
113380
|
113381
|
113382
|
113396