Update of /cvsroot/koha/koha/updater In directory usw-pr-cvs1:/tmp/cvs-serv6853 Modified Files: updatedatabase Log Message: Added some more tables to the database updater. Modified barcode to be 20 characters long instead of 9. Index: updatedatabase =================================================================== RCS file: /cvsroot/koha/koha/updater/updatedatabase,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** updatedatabase 2001/11/19 18:26:50 1.1 --- updatedatabase 2001/11/19 20:29:46 1.2 *************** *** 19,30 **** while (my ($table) = $sth->fetchrow) { $tables{$table}=1; - print "Table: $table\n"; } # Add tables required by Z-3950 scripts ! unless ($tables{'z3950queue') { my $sti=$dbh->prepare("create table z3950queue (id int auto_increment primary key, term text, type char(10), startdate int, enddate int, done smallint, results longblob, numercords int, servers text, identifier char(30))"); $sti->execute; --- 19,42 ---- while (my ($table) = $sth->fetchrow) { $tables{$table}=1; } + # Add tables for virtual bookshelf management + unless ($tables{'shelfcontents'}) { + print "Adding shelfcontents table...\n"; + my $sti=$dbh->prepare("create table shelfcontents (shelfnumber int not null, itemnumber int not null, flags int)"); + $sti->execute; + } + unless ($tables{'bookshelf'}) { + print "Adding bookshelf table...\n"; + my $sti=$dbh->prepare("create table bookshelf (shelfnumber int auto_increment primary key, shelfname char(255))"); + $sti->execute; + } + # Add tables required by Z-3950 scripts ! unless ($tables{'z3950queue'}) { ! print "Adding z3950queue table...\n"; my $sti=$dbh->prepare("create table z3950queue (id int auto_increment primary key, term text, type char(10), startdate int, enddate int, done smallint, results longblob, numercords int, servers text, identifier char(30))"); $sti->execute; *************** *** 32,39 **** --- 44,53 ---- unless ($tables{'z3950results'}) { + print "Adding z3950results table...\n"; my $sti=$dbh->prepare("create table z3950results (id int auto_increment primary key, queryid int, server char(255), startdate int, enddate int, results longblob, numrecords int, numdownloaded int, highestseen int, active smallint)"); $sti->execute; } unless ($tables{'z3950servers'}) { + print "Adding z3950servers table...\n"; my $sti=$dbh->prepare("create table z3950servers (host char(255), port int, db char(255), userid char(255), password char(255), name text, id int, checked smallint, rank int)"); $sti->execute; *************** *** 53,56 **** --- 67,71 ---- unless ($types{'lccn'}) { # Add LCCN field to biblioitems db + print "Adding lccn field to biblioitems table...\n"; my $sti=$dbh->prepare("alter table biblioitems add column lccn char(25)"); $sti->execute; *************** *** 58,63 **** --- 73,98 ---- unless ($types{'marc'}) { # Add MARC field to biblioitems db (not used anymore) + print "Adding marc field to biblioitems table...\n"; my $sti=$dbh->prepare("alter table biblioitems add column marc text"); $sti->execute; + } + + # Get list of columns from biblioitems table + my %itemtypes; + + my $sth=$dbh->prepare("show columns from items"); + $sth->execute; + while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) { + $itemtypes{$column}=$type; + } + + unless ($itemtypes{'barcode'} eq 'varchar(20)') { + $itemtypes{'barcode'}=~/varchar\((\d+)\)/; + my $oldlength=$1; + if ($oldlength<20) { + print "Setting maximum barcode length to 20 (was $oldlength).\n"; + my $sti=$dbh->prepare("alter table items change barcode barcode varchar(20) not null"); + $sti->execute; + } }
Hi Steve Looks like the updater is coming along nicely. I wonder if it would be worthwhile to do some kinda check the mysql version running, and if its newish .. make the tabletypes become MyISAM .. which allows for the fulltext searching etc. At the moment because a table type is not specified in the database creation sql, the tables will be whatever the default table type was at the time the database was created. For HLT .. we started off with an old debian stable version of Mysql which meant our table types were all ISAM. Ive gone thru and made them all MyISAM which has helped performance a little. I think MyISAM is now the default and in version 4 on InnoDB will be the new default. But If we want fulltext indices we will need the table types to be either MyISAM or we could go cutting edge InnoDB ? Just thinking aloud Chris -- Chris Cormack Programmer 025 500 789 Katipo Communications Ltd chris@katipo.co.nz www.katipo.co.nz
participants (2)
-
Chris Cormack -
Steve Tonnesen