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

(-)a/installer/data/mysql/kohastructure.sql (-17 lines)
Lines 244-251 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
244
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
244
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
245
  `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
245
  `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
246
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
246
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
247
  `ethnicity` varchar(50) default NULL, -- unused in Koha
248
  `ethnotes` varchar(255) default NULL, -- unused in Koha
249
  `sex` varchar(1) default NULL, -- patron/borrower's gender
247
  `sex` varchar(1) default NULL, -- patron/borrower's gender
250
  `password` varchar(60) default NULL, -- patron/borrower's encrypted password
248
  `password` varchar(60) default NULL, -- patron/borrower's encrypted password
251
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
249
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
Lines 873-880 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
873
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
871
  `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
874
  `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
872
  `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
875
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
873
  `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
876
  `ethnicity` varchar(50) default NULL, -- unused in Koha
877
  `ethnotes` varchar(255) default NULL, -- unused in Koha
878
  `sex` varchar(1) default NULL, -- patron/borrower's gender
874
  `sex` varchar(1) default NULL, -- patron/borrower's gender
879
  `password` varchar(30) default NULL, -- patron/borrower's encrypted password
875
  `password` varchar(30) default NULL, -- patron/borrower's encrypted password
880
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
876
  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
Lines 957-973 CREATE TABLE `deleteditems` ( Link Here
957
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
953
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
958
954
959
--
955
--
960
-- Table structure for table `ethnicity`
961
--
962
963
DROP TABLE IF EXISTS `ethnicity`;
964
CREATE TABLE `ethnicity` (
965
  `code` varchar(10) NOT NULL default '',
966
  `name` varchar(255) default NULL,
967
  PRIMARY KEY  (`code`)
968
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
969
970
--
971
-- Table structure for table `export_format`
956
-- Table structure for table `export_format`
972
--
957
--
973
958
Lines 3335-3342 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3335
  `guarantorid` int(11) DEFAULT NULL,
3320
  `guarantorid` int(11) DEFAULT NULL,
3336
  `borrowernotes` mediumtext,
3321
  `borrowernotes` mediumtext,
3337
  `relationship` varchar(100) DEFAULT NULL,
3322
  `relationship` varchar(100) DEFAULT NULL,
3338
  `ethnicity` varchar(50) DEFAULT NULL,
3339
  `ethnotes` varchar(255) DEFAULT NULL,
3340
  `sex` varchar(1) DEFAULT NULL,
3323
  `sex` varchar(1) DEFAULT NULL,
3341
  `password` varchar(30) DEFAULT NULL,
3324
  `password` varchar(30) DEFAULT NULL,
3342
  `flags` int(11) DEFAULT NULL,
3325
  `flags` int(11) DEFAULT NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +56 lines)
Lines 9979-9984 if ( CheckVersion($DBversion) ) { Link Here
9979
}
9979
}
9980
9980
9981
9981
9982
$DBversion = "3.19.00.XXX";
9983
if ( CheckVersion($DBversion) ) {
9984
9985
    my $done = 0;
9986
    my $count_ethnicity = $dbh->selectrow_arrayref(q|
9987
        SELECT COUNT(*) FROM ethnicity
9988
    |);
9989
    my $count_borrower_modifications = $dbh->selectrow_arrayref(q|
9990
        SELECT COUNT(*)
9991
        FROM borrower_modifications
9992
        WHERE ethnicity IS NOT NULL
9993
            OR ethnotes IS NOT NULL
9994
    |);
9995
    my $count_borrowers = $dbh->selectrow_arrayref(q|
9996
        SELECT COUNT(*)
9997
        FROM borrowers
9998
        WHERE ethnicity IS NOT NULL
9999
            OR ethnotes IS NOT NULL
10000
    |);
10001
    # We don't care about the ethnicity of the deleted borrowers, right?
10002
    if ( $count_ethnicity->[0] == 0
10003
            and $count_borrower_modifications->[0] == 0
10004
            and $count_borrowers->[0] == 0
10005
    ) {
10006
        $dbh->do(q|
10007
            DROP TABLE ethnicity
10008
        |);
10009
        $dbh->do(q|
10010
            ALTER TABLE borrower_modifications
10011
            DROP COLUMN ethnicity,
10012
            DROP COLUMN ethnotes
10013
        |);
10014
        $dbh->do(q|
10015
            ALTER TABLE borrowers
10016
            DROP COLUMN ethnicity,
10017
            DROP COLUMN ethnotes
10018
        |);
10019
        $dbh->do(q|
10020
            ALTER TABLE deletedborrowers
10021
            DROP COLUMN ethnicity,
10022
            DROP COLUMN ethnotes
10023
        |);
10024
        $done = 1;
10025
    }
10026
    if ( $done ) {
10027
        print "Upgrade to $DBversion done (Bug 10020: Drop table ethnicity and columns ethnicity and ethnotes)\n";
10028
    }
10029
    else {
10030
        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";
10031
    }
10032
10033
    SetVersion ($DBversion);
10034
}
10035
10036
10037
9982
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10038
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
9983
# SEE bug 13068
10039
# SEE bug 13068
9984
# if there is anything in the atomicupdate, read and execute it.
10040
# if there is anything in the atomicupdate, read and execute it.
9985
- 

Return to bug 10020