From 2f0df660361242744c650d4b98194baa1941f571 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 17 Jul 2018 10:37:59 +0000 Subject: [PATCH] Bug 14570 [QA Followup]: Rename relationships table to borrower_relationships --- Koha/Patron/Relationship.pm | 2 +- Koha/Patron/Relationships.pm | 2 +- .../Result/{Relationship.pm => BorrowerRelationship.pm} | 12 ++++++------ installer/data/mysql/atomicupdate/bug_14570.sql | 6 ++++-- installer/data/mysql/kohastructure.sql | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) rename Koha/Schema/Result/{Relationship.pm => BorrowerRelationship.pm} (85%) diff --git a/Koha/Patron/Relationship.pm b/Koha/Patron/Relationship.pm index 2d42ab4e1b..24994aa2b7 100644 --- a/Koha/Patron/Relationship.pm +++ b/Koha/Patron/Relationship.pm @@ -67,7 +67,7 @@ sub guarantee { =cut sub _type { - return 'Relationship'; + return 'BorrowerRelationship'; } 1; diff --git a/Koha/Patron/Relationships.pm b/Koha/Patron/Relationships.pm index e9da572878..981ceac5b7 100644 --- a/Koha/Patron/Relationships.pm +++ b/Koha/Patron/Relationships.pm @@ -84,7 +84,7 @@ sub guarantees { =cut sub _type { - return 'Relationship'; + return 'BorrowerRelationship'; } sub object_class { diff --git a/Koha/Schema/Result/Relationship.pm b/Koha/Schema/Result/BorrowerRelationship.pm similarity index 85% rename from Koha/Schema/Result/Relationship.pm rename to Koha/Schema/Result/BorrowerRelationship.pm index c815df4df9..5445d44f10 100644 --- a/Koha/Schema/Result/Relationship.pm +++ b/Koha/Schema/Result/BorrowerRelationship.pm @@ -1,12 +1,12 @@ use utf8; -package Koha::Schema::Result::Relationship; +package Koha::Schema::Result::BorrowerRelationship; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE =head1 NAME -Koha::Schema::Result::Relationship +Koha::Schema::Result::BorrowerRelationship =cut @@ -15,11 +15,11 @@ use warnings; use base 'DBIx::Class::Core'; -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("relationships"); +__PACKAGE__->table("borrower_relationships"); =head1 ACCESSORS @@ -124,8 +124,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-05-03 13:19:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2Nv437KMrKHvpQleXLOjYw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-07-17 11:22:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YKFiZSR3WRi1nvtLOdGV9A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_14570.sql b/installer/data/mysql/atomicupdate/bug_14570.sql index 77d1eb7e5f..9c8e987a96 100644 --- a/installer/data/mysql/atomicupdate/bug_14570.sql +++ b/installer/data/mysql/atomicupdate/bug_14570.sql @@ -1,4 +1,4 @@ -CREATE TABLE `relationships` ( +CREATE TABLE `borrower_relationships` ( id INT(11) NOT NULL AUTO_INCREMENT, guarantor_id INT(11) NULL DEFAULT NULL, guarantee_id INT(11) NOT NULL, @@ -12,6 +12,8 @@ CREATE TABLE `relationships` ( UPDATE borrowers LEFT JOIN borrowers guarantor ON ( borrowers.guarantorid = guarantor.borrowernumber ) SET borrowers.guarantorid = NULL WHERE guarantor.borrowernumber IS NULL; -INSERT INTO relationships ( guarantor_id, guarantee_id, relationship, surname, firstname ) SELECT guarantorid, borrowernumber, relationship, contactname, contactfirstname FROM borrowers WHERE guarantorid IS NOT NULL OR contactname != ""; +INSERT INTO borrower_relationships ( guarantor_id, guarantee_id, relationship, surname, firstname ) SELECT guarantorid, borrowernumber, relationship, contactname, contactfirstname FROM borrowers WHERE guarantorid IS NOT NULL OR contactname != ""; ALTER TABLE borrowers DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; +ALTER TABLE deletedborrowers DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; +ALTER TABLE borrowermodification DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f842f80f52..3d04f5b68e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4100,8 +4100,8 @@ CREATE TABLE IF NOT EXISTS club_fields ( -- Table structure for table 'guarantors_guarantees' -- -DROP TABLE IF EXISTS relationships; -CREATE TABLE `relationships` ( +DROP TABLE IF EXISTS borrower_relationships; +CREATE TABLE `borrower_relationships` ( id INT(11) NOT NULL AUTO_INCREMENT, guarantor_id INT(11) NULL DEFAULT NULL, guarantee_id INT(11) NOT NULL, -- 2.11.0