`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/borrower'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
`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/borrower'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
) 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`
--
`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,
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.