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 3314-3321 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3314
  `guarantorid` int(11) DEFAULT NULL,
3299
  `guarantorid` int(11) DEFAULT NULL,
3315
  `borrowernotes` mediumtext,
3300
  `borrowernotes` mediumtext,
3316
  `relationship` varchar(100) DEFAULT NULL,
3301
  `relationship` varchar(100) DEFAULT NULL,
3317
  `ethnicity` varchar(50) DEFAULT NULL,
3318
  `ethnotes` varchar(255) DEFAULT NULL,
3319
  `sex` varchar(1) DEFAULT NULL,
3302
  `sex` varchar(1) DEFAULT NULL,
3320
  `password` varchar(30) DEFAULT NULL,
3303
  `password` varchar(30) DEFAULT NULL,
3321
  `flags` int(11) DEFAULT NULL,
3304
  `flags` int(11) DEFAULT NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +56 lines)
Lines 10025-10030 if ( CheckVersion($DBversion) ) { Link Here
10025
    SetVersion ($DBversion);
10025
    SetVersion ($DBversion);
10026
}
10026
}
10027
10027
10028
$DBversion = "3.19.00.XXX";
10029
if ( CheckVersion($DBversion) ) {
10030
10031
    my $done = 0;
10032
    my $count_ethnicity = $dbh->selectrow_arrayref(q|
10033
        SELECT COUNT(*) FROM ethnicity
10034
    |);
10035
    my $count_borrower_modifications = $dbh->selectrow_arrayref(q|
10036
        SELECT COUNT(*)
10037
        FROM borrower_modifications
10038
        WHERE ethnicity IS NOT NULL
10039
            OR ethnotes IS NOT NULL
10040
    |);
10041
    my $count_borrowers = $dbh->selectrow_arrayref(q|
10042
        SELECT COUNT(*)
10043
        FROM borrowers
10044
        WHERE ethnicity IS NOT NULL
10045
            OR ethnotes IS NOT NULL
10046
    |);
10047
    # We don't care about the ethnicity of the deleted borrowers, right?
10048
    if ( $count_ethnicity->[0] == 0
10049
            and $count_borrower_modifications->[0] == 0
10050
            and $count_borrowers->[0] == 0
10051
    ) {
10052
        $dbh->do(q|
10053
            DROP TABLE ethnicity
10054
        |);
10055
        $dbh->do(q|
10056
            ALTER TABLE borrower_modifications
10057
            DROP COLUMN ethnicity,
10058
            DROP COLUMN ethnotes
10059
        |);
10060
        $dbh->do(q|
10061
            ALTER TABLE borrowers
10062
            DROP COLUMN ethnicity,
10063
            DROP COLUMN ethnotes
10064
        |);
10065
        $dbh->do(q|
10066
            ALTER TABLE deletedborrowers
10067
            DROP COLUMN ethnicity,
10068
            DROP COLUMN ethnotes
10069
        |);
10070
        $done = 1;
10071
    }
10072
    if ( $done ) {
10073
        print "Upgrade to $DBversion done (Bug 10020: Drop table ethnicity and columns ethnicity and ethnotes)\n";
10074
    }
10075
    else {
10076
        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";
10077
    }
10078
10079
    SetVersion ($DBversion);
10080
}
10081
10082
10083
10028
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10084
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10029
# SEE bug 13068
10085
# SEE bug 13068
10030
# if there is anything in the atomicupdate, read and execute it.
10086
# if there is anything in the atomicupdate, read and execute it.
10031
- 

Return to bug 10020