Update of /cvsroot/koha/koha/updater In directory usw-pr-cvs1:/tmp/cvs-serv25940/updater Modified Files: updatedatabase Log Message: added database patchs to the updater/updatedatabase script changes the type of the datesent and datearrived fields in the branchtransfers table from date to datetime. completely re-organises the branchcategories table. As this has previously been unused it shouldnt effect anyone. Index: updatedatabase =================================================================== RCS file: /cvsroot/koha/koha/updater/updatedatabase,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** updatedatabase 19 Nov 2001 23:28:59 -0000 1.3 --- updatedatabase 26 Mar 2002 05:08:52 -0000 1.4 *************** *** 105,108 **** --- 105,157 ---- } + # extending the timestamp in branchtransfers... + my %branchtransfers; + + my $sth=$dbh->prepare("show columns from branchtransfers"); + $sth->execute; + while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) { + $branchtransfers{$column}=$type; + } + + unless ($branchtransfers{'datesent'} eq 'datetime') { + print "Setting type of datesent in branchtransfers to datetime.\n"; + my $sti=$dbh->prepare("alter table branchtransfers change datesent datesent datetime"); + $sti->execute; + } + + unless ($branchtransfers{'datearrived'} eq 'datetime') { + print "Setting type of datearrived in branchtransfers to datetime.\n"; + my $sti=$dbh->prepare("alter table branchtransfers change datearrived datearrived datetime"); + $sti->execute; + } + + # changing the branchcategories table around... + my %branchcategories; + + my $sth=$dbh->prepare("show columns from branchcategories"); + $sth->execute; + while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) { + $branchcategories{$column}=$type; + } + + unless ($branchcategories{'categorycode'} eq 'varchar(4)') { + print "Setting type of categorycode in branchcategories to varchar(4),\n and making the primary key.\n"; + my $sti=$dbh->prepare("alter table branchcategories change categorycode categorycode varchar(4) not null"); + $sti->execute; + $sti=$dbh->prepare("alter table branchcategories add primary key (categorycode)"); + $sti->execute; + } + + unless ($branchcategories{'branchcode'} eq 'varchar(4)') { + print "Setting type of branchcode in branchcategories to varchar(4).\n"; + my $sti=$dbh->prepare("alter table branchcategories change branchcode branchcode varchar(4)"); + $sti->execute; + } + + unless ($branchcategories{'codedescription'} eq 'text') { + print "Replacing branchholding in branchcategories with codedescription text.\n"; + my $sti=$dbh->prepare("alter table branchcategories change branchholding codedescription text"); + $sti->execute; + } $sth->finish;
participants (1)
-
Finlay Thompson