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 / +55 lines)
Lines 10142-10147 if(CheckVersion($DBversion)) { Link Here
10142
    SetVersion($DBversion);
10142
    SetVersion($DBversion);
10143
}
10143
}
10144
10144
10145
$DBversion = "3.19.00.XXX";
10146
if ( CheckVersion($DBversion) ) {
10147
10148
    my $done = 0;
10149
    my $count_ethnicity = $dbh->selectrow_arrayref(q|
10150
        SELECT COUNT(*) FROM ethnicity
10151
    |);
10152
    my $count_borrower_modifications = $dbh->selectrow_arrayref(q|
10153
        SELECT COUNT(*)
10154
        FROM borrower_modifications
10155
        WHERE ethnicity IS NOT NULL
10156
            OR ethnotes IS NOT NULL
10157
    |);
10158
    my $count_borrowers = $dbh->selectrow_arrayref(q|
10159
        SELECT COUNT(*)
10160
        FROM borrowers
10161
        WHERE ethnicity IS NOT NULL
10162
            OR ethnotes IS NOT NULL
10163
    |);
10164
    # We don't care about the ethnicity of the deleted borrowers, right?
10165
    if ( $count_ethnicity->[0] == 0
10166
            and $count_borrower_modifications->[0] == 0
10167
            and $count_borrowers->[0] == 0
10168
    ) {
10169
        $dbh->do(q|
10170
            DROP TABLE ethnicity
10171
        |);
10172
        $dbh->do(q|
10173
            ALTER TABLE borrower_modifications
10174
            DROP COLUMN ethnicity,
10175
            DROP COLUMN ethnotes
10176
        |);
10177
        $dbh->do(q|
10178
            ALTER TABLE borrowers
10179
            DROP COLUMN ethnicity,
10180
            DROP COLUMN ethnotes
10181
        |);
10182
        $dbh->do(q|
10183
            ALTER TABLE deletedborrowers
10184
            DROP COLUMN ethnicity,
10185
            DROP COLUMN ethnotes
10186
        |);
10187
        $done = 1;
10188
    }
10189
    if ( $done ) {
10190
        print "Upgrade to $DBversion done (Bug 10020: Drop table ethnicity and columns ethnicity and ethnotes)\n";
10191
    }
10192
    else {
10193
        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";
10194
    }
10195
10196
    SetVersion ($DBversion);
10197
}
10198
10199
10145
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10200
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10146
# SEE bug 13068
10201
# SEE bug 13068
10147
# if there is anything in the atomicupdate, read and execute it.
10202
# if there is anything in the atomicupdate, read and execute it.
10148
- 

Return to bug 10020