From ca0e7541ecdff13ada9ba8ffbd992c963959d30f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 Jan 2021 06:58:45 -0500 Subject: [PATCH] Bug 26995: Drop column relationship from borrowers, deletedborrowers and borrower_modifications tables Bug 14570 added a borrower_relationships table but it didn't remove the relationship column from the following tables: - deletedborrowers - borrowers - borrower_modifications Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- C4/Auth_with_ldap.pm | 1 - C4/SIP/ILS/Patron.pm | 1 - .../data/mysql/atomicupdate/bug_26995.perl | 23 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 3 --- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_26995.perl diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 4648d3c093..679c045141 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -474,7 +474,6 @@ C4::Auth - Authenticates Koha users | contactfirstname | text | YES | | NULL | | | contacttitle | text | YES | | NULL | | | borrowernotes | mediumtext | YES | | NULL | | - | relationship | varchar(100) | YES | | NULL | | | ethnicity | varchar(50) | YES | | NULL | | | ethnotes | varchar(255) | YES | | NULL | | | sex | varchar(1) | YES | | NULL | | diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index d5ac629023..b72128d7ab 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -690,7 +690,6 @@ __END__ | contactfirstname | text | YES | | NULL | | | contacttitle | text | YES | | NULL | | | borrowernotes | mediumtext | YES | | NULL | | -| relationship | varchar(100) | YES | | NULL | | | ethnicity | varchar(50) | YES | | NULL | | | ethnotes | varchar(255) | YES | | NULL | | | sex | varchar(1) | YES | | NULL | | diff --git a/installer/data/mysql/atomicupdate/bug_26995.perl b/installer/data/mysql/atomicupdate/bug_26995.perl new file mode 100644 index 0000000000..d578c700bb --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_26995.perl @@ -0,0 +1,23 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + if ( !column_exists( 'borrowers', 'relationship' ) ) { + $dbh->do(q{ + ALTER TABLE borrowers DROP COLUMN relationship + }); + } + + if ( !column_exists( 'deletedborrowers', 'relationship' ) ) { + $dbh->do(q{ + ALTER TABLE deletedborrowers DROP COLUMN relationship + }); + } + + if ( !column_exists( 'borrower_modifications', 'relationship' ) ) { + $dbh->do(q{ + ALTER TABLE borrower_modifications DROP COLUMN relationship + }); + } + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 26995, "Drop column relationship from borrower tables"); +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e41efb653b..4896b9dcee 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1283,7 +1283,6 @@ CREATE TABLE `borrower_modifications` ( `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `password` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `flags` int(11) DEFAULT NULL, @@ -1400,7 +1399,6 @@ CREATE TABLE `borrowers` ( `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include first name of guarantor', `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor', `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface', - `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor', `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender', `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password', `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions', @@ -2402,7 +2400,6 @@ CREATE TABLE `deletedborrowers` ( `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include first name of guarantor', `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor', `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface', - `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor', `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender', `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s encrypted password', `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions', -- 2.39.5