Bugzilla – Attachment 37984 Details for
Bug 10020
Remove old code related to 'ethnicity'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 10020: Remove DB table and fields related to ethnicity
SIGNED-OFF-Bug-10020-Remove-DB-table-and-fields-re.patch (text/plain), 6.21 KB, created by
Nick Clemens (kidclamp)
on 2015-04-16 18:30:00 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 10020: Remove DB table and fields related to ethnicity
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2015-04-16 18:30:00 UTC
Size:
6.21 KB
patch
obsolete
>From 982f4763ee6b0e993f38f97ef84dfdd5bc7870d3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 10 Apr 2015 13:19:50 +0200 >Subject: [PATCH] [SIGNED OFF] Bug 10020: Remove DB table and fields related to > ethnicity > >This patch remove the ethnicity table and the ethnicity and ethnotes >fields from the 3 tables: borrowers, deletedborrowers and >borrower_modifications IF no data exist. > >Test plan: >0/ Apply this patch and update the Koha::Schema >(misc/devel/update_dbix_class_files.pl). >1/ Make sure the ethnicity has at least 1 entry >2/ Launch the updatedb entry and confirm you get a warning message and >the DB structure is not updated. >3/ truncate the ethnicity table and fill ethnicity (or ethnotes) for at least 1 >row of the borrowers table. >4/ Launch the updatedb entry and confirm you get a warning message and >the DB structure is not updated. >5/ Make sure the ethnicity table is empty as well as the ethniciy and >the ethnotes fields of borrowers, deletedborrowers and >borrower_modifications >6/ Launch the updatedb entry and confirm you don't get the warning >message and the DB structure is updated (ie. table and fields dropped). > >Signed-off-by: Nick Clemens <nick@quecheelibrary.org> >--- > installer/data/mysql/kohastructure.sql | 17 ----------- > installer/data/mysql/updatedatabase.pl | 56 ++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+), 17 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index a74d81a..75064bd 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -244,8 +244,6 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons > `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations > `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client > `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor >- `ethnicity` varchar(50) default NULL, -- unused in Koha >- `ethnotes` varchar(255) default NULL, -- unused in Koha > `sex` varchar(1) default NULL, -- patron/borrower's gender > `password` varchar(60) default NULL, -- patron/borrower's encrypted password > `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions >@@ -873,8 +871,6 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower > `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations > `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client > `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor >- `ethnicity` varchar(50) default NULL, -- unused in Koha >- `ethnotes` varchar(255) default NULL, -- unused in Koha > `sex` varchar(1) default NULL, -- patron/borrower's gender > `password` varchar(30) default NULL, -- patron/borrower's encrypted password > `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions >@@ -957,17 +953,6 @@ CREATE TABLE `deleteditems` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > > -- >--- Table structure for table `ethnicity` >--- >- >-DROP TABLE IF EXISTS `ethnicity`; >-CREATE TABLE `ethnicity` ( >- `code` varchar(10) NOT NULL default '', >- `name` varchar(255) default NULL, >- PRIMARY KEY (`code`) >-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; >- >--- > -- Table structure for table `export_format` > -- > >@@ -3314,8 +3299,6 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` ( > `guarantorid` int(11) DEFAULT NULL, > `borrowernotes` mediumtext, > `relationship` varchar(100) DEFAULT NULL, >- `ethnicity` varchar(50) DEFAULT NULL, >- `ethnotes` varchar(255) DEFAULT NULL, > `sex` varchar(1) DEFAULT NULL, > `password` varchar(30) DEFAULT NULL, > `flags` int(11) DEFAULT NULL, >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index bc765f1..eba2202 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10025,6 +10025,62 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ >+ my $done = 0; >+ my $count_ethnicity = $dbh->selectrow_arrayref(q| >+ SELECT COUNT(*) FROM ethnicity >+ |); >+ my $count_borrower_modifications = $dbh->selectrow_arrayref(q| >+ SELECT COUNT(*) >+ FROM borrower_modifications >+ WHERE ethnicity IS NOT NULL >+ OR ethnotes IS NOT NULL >+ |); >+ my $count_borrowers = $dbh->selectrow_arrayref(q| >+ SELECT COUNT(*) >+ FROM borrowers >+ WHERE ethnicity IS NOT NULL >+ OR ethnotes IS NOT NULL >+ |); >+ # We don't care about the ethnicity of the deleted borrowers, right? >+ if ( $count_ethnicity->[0] == 0 >+ and $count_borrower_modifications->[0] == 0 >+ and $count_borrowers->[0] == 0 >+ ) { >+ $dbh->do(q| >+ DROP TABLE ethnicity >+ |); >+ $dbh->do(q| >+ ALTER TABLE borrower_modifications >+ DROP COLUMN ethnicity, >+ DROP COLUMN ethnotes >+ |); >+ $dbh->do(q| >+ ALTER TABLE borrowers >+ DROP COLUMN ethnicity, >+ DROP COLUMN ethnotes >+ |); >+ $dbh->do(q| >+ ALTER TABLE deletedborrowers >+ DROP COLUMN ethnicity, >+ DROP COLUMN ethnotes >+ |); >+ $done = 1; >+ } >+ if ( $done ) { >+ print "Upgrade to $DBversion done (Bug 10020: Drop table ethnicity and columns ethnicity and ethnotes)\n"; >+ } >+ else { >+ print "Upgrade to $DBversion done (Bug 10020: This database contains data related to 'ethnicity'. No change will be done on the DB structure but note that the Koha codebase does not use it)\n"; >+ } >+ >+ SetVersion ($DBversion); >+} >+ >+ >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >-- >1.9.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 10020
:
37639
|
37640
|
37641
|
37984
|
37985
|
38400
|
38401
|
43103
|
43104
|
43174
|
43384