View | Details | Raw Unified | Return to bug 10020
Collapse All | Expand All

(-)a/installer/data/mysql/kohastructure.sql (-17 lines)
Lines 245-252 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
245
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
245
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
246
  `borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
246
  `borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
247
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
247
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
248
  `ethnicity` varchar(50) default NULL, -- unused in Koha
249
  `ethnotes` varchar(255) default NULL, -- unused in Koha
250
  `sex` varchar(1) default NULL, -- patron/borrower's gender
248
  `sex` varchar(1) default NULL, -- patron/borrower's gender
251
  `password` varchar(60) default NULL, -- patron/borrower's encrypted password
249
  `password` varchar(60) default NULL, -- patron/borrower's encrypted password
252
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
250
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
Lines 877-884 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
877
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
875
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
878
  `borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
876
  `borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
879
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
877
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
880
  `ethnicity` varchar(50) default NULL, -- unused in Koha
881
  `ethnotes` varchar(255) default NULL, -- unused in Koha
882
  `sex` varchar(1) default NULL, -- patron/borrower's gender
878
  `sex` varchar(1) default NULL, -- patron/borrower's gender
883
  `password` varchar(30) default NULL, -- patron/borrower's encrypted password
879
  `password` varchar(30) default NULL, -- patron/borrower's encrypted password
884
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
880
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
Lines 962-978 CREATE TABLE `deleteditems` ( Link Here
962
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
958
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
963
959
964
--
960
--
965
-- Table structure for table `ethnicity`
966
--
967
968
DROP TABLE IF EXISTS `ethnicity`;
969
CREATE TABLE `ethnicity` (
970
  `code` varchar(10) NOT NULL default '',
971
  `name` varchar(255) default NULL,
972
  PRIMARY KEY  (`code`)
973
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
974
975
--
976
-- Table structure for table `export_format`
961
-- Table structure for table `export_format`
977
--
962
--
978
963
Lines 3321-3328 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3321
  `guarantorid` int(11) DEFAULT NULL,
3306
  `guarantorid` int(11) DEFAULT NULL,
3322
  `borrowernotes` mediumtext,
3307
  `borrowernotes` mediumtext,
3323
  `relationship` varchar(100) DEFAULT NULL,
3308
  `relationship` varchar(100) DEFAULT NULL,
3324
  `ethnicity` varchar(50) DEFAULT NULL,
3325
  `ethnotes` varchar(255) DEFAULT NULL,
3326
  `sex` varchar(1) DEFAULT NULL,
3309
  `sex` varchar(1) DEFAULT NULL,
3327
  `password` varchar(30) DEFAULT NULL,
3310
  `password` varchar(30) DEFAULT NULL,
3328
  `flags` int(11) DEFAULT NULL,
3311
  `flags` int(11) DEFAULT NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +55 lines)
Lines 10986-10991 if ( CheckVersion($DBversion) ) { Link Here
10986
    SetVersion($DBversion);
10986
    SetVersion($DBversion);
10987
}
10987
}
10988
10988
10989
$DBversion = "3.19.00.XXX";
10990
if ( CheckVersion($DBversion) ) {
10991
10992
    my $done = 0;
10993
    my $count_ethnicity = $dbh->selectrow_arrayref(q|
10994
        SELECT COUNT(*) FROM ethnicity
10995
    |);
10996
    my $count_borrower_modifications = $dbh->selectrow_arrayref(q|
10997
        SELECT COUNT(*)
10998
        FROM borrower_modifications
10999
        WHERE ethnicity IS NOT NULL
11000
            OR ethnotes IS NOT NULL
11001
    |);
11002
    my $count_borrowers = $dbh->selectrow_arrayref(q|
11003
        SELECT COUNT(*)
11004
        FROM borrowers
11005
        WHERE ethnicity IS NOT NULL
11006
            OR ethnotes IS NOT NULL
11007
    |);
11008
    # We don't care about the ethnicity of the deleted borrowers, right?
11009
    if ( $count_ethnicity->[0] == 0
11010
            and $count_borrower_modifications->[0] == 0
11011
            and $count_borrowers->[0] == 0
11012
    ) {
11013
        $dbh->do(q|
11014
            DROP TABLE ethnicity
11015
        |);
11016
        $dbh->do(q|
11017
            ALTER TABLE borrower_modifications
11018
            DROP COLUMN ethnicity,
11019
            DROP COLUMN ethnotes
11020
        |);
11021
        $dbh->do(q|
11022
            ALTER TABLE borrowers
11023
            DROP COLUMN ethnicity,
11024
            DROP COLUMN ethnotes
11025
        |);
11026
        $dbh->do(q|
11027
            ALTER TABLE deletedborrowers
11028
            DROP COLUMN ethnicity,
11029
            DROP COLUMN ethnotes
11030
        |);
11031
        $done = 1;
11032
    }
11033
    if ( $done ) {
11034
        print "Upgrade to $DBversion done (Bug 10020: Drop table ethnicity and columns ethnicity and ethnotes)\n";
11035
    }
11036
    else {
11037
        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";
11038
    }
11039
11040
    SetVersion ($DBversion);
11041
}
11042
11043
10989
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
11044
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10990
# SEE bug 13068
11045
# SEE bug 13068
10991
# if there is anything in the atomicupdate, read and execute it.
11046
# if there is anything in the atomicupdate, read and execute it.
10992
- 

Return to bug 10020