[Koha-cvs] CVS: koha/updater updatedatabase,1.65,1.66
MJ Ray
slef at users.sourceforge.net
Wed Nov 12 17:14:45 CET 2003
Update of /cvsroot/koha/koha/updater
In directory sc8-pr-cvs1:/tmp/cvs-serv4869
Modified Files:
updatedatabase
Log Message:
lengthen cardnumber to 16 and make it unique
Index: updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -r1.65 -r1.66
*** updatedatabase 6 Nov 2003 15:07:11 -0000 1.65
--- updatedatabase 12 Nov 2003 16:14:42 -0000 1.66
***************
*** 763,769 ****
}
! # Get list of columns from items table
my %itemtypes;
my %nullenabled;
$sth = $dbh->prepare("show columns from items");
$sth->execute;
--- 763,801 ----
}
! # Get list of columns from borrowers table
my %itemtypes;
my %nullenabled;
+ $sth = $dbh->prepare("show columns from borrowers");
+ $sth->execute;
+ while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
+ {
+ $itemtypes{$column} = $type;
+ $nullenabled{$column} = $null;
+ }
+
+ unless ( $itemtypes{'cardnumber'} eq 'varchar(20)' ) {
+ $itemtypes{'cardnumber'} =~ /varchar\((\d+)\)/;
+ my $oldlength = $1;
+ if ( $oldlength < 16 ) {
+ print "Setting maximum cardnumber length to 16 (was $oldlength) and marking unique.\n";
+ my $sti =
+ $dbh->prepare(
+ "alter table borrowers change cardnumber cardnumber varchar(16)");
+ $sti->execute;
+ $sti->finish;
+ $sti =
+ $dbh->prepare(
+ "alter table borrowers drop index cardnumber");
+ $sti->execute;
+ $sti->finish;
+ $sti =
+ $dbh->prepare(
+ "alter table borrowers add unique(cardnumber)");
+ $sti->execute;
+ $sti->finish;
+ }
+ }
+ #
+ # Get list of columns from items table
$sth = $dbh->prepare("show columns from items");
$sth->execute;
***************
*** 924,927 ****
--- 956,962 ----
# $Log$
+ # Revision 1.66 2003/11/12 16:14:42 slef
+ # lengthen cardnumber to 16 and make it unique
+ #
# Revision 1.65 2003/11/06 15:07:11 tipaul
# adding marc fields in deletedbiblio & deleteditems
More information about the Koha-cvs
mailing list