[Koha-cvs] CVS: koha/updater updatedatabase,1.58,1.59
Paul POULAIN
tipaul at users.sourceforge.net
Tue Sep 30 18:22:07 CEST 2003
Update of /cvsroot/koha/koha/updater
In directory sc8-pr-cvs1:/tmp/cvs-serv32715/updater
Modified Files:
updatedatabase
Log Message:
adding barcode NOT mandatory feature. Just run updatedatabase to get it.
Note it's impossible to issue an item without barcode, as issue/returns is based on barcode...
Index: updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -r1.58 -r1.59
*** updatedatabase 16 Jul 2003 04:08:29 -0000 1.58
--- updatedatabase 30 Sep 2003 16:22:05 -0000 1.59
***************
*** 259,262 ****
--- 259,265 ----
);
+ # the other hash contains other actions that can't be done elsewhere. they are done
+ # either BEFORE of AFTER everything else, depending on "when" entry (default => AFTER)
+
# The tabledata hash contains data that should be in the tables.
# The uniquefieldrequired hash entry is used to determine which (if any) fields
***************
*** 617,620 ****
--- 620,624 ----
}
+
# Now add any missing tables
foreach $table ( keys %requiretables ) {
***************
*** 758,762 ****
# Get list of columns from items table
my %itemtypes;
!
$sth = $dbh->prepare("show columns from items");
$sth->execute;
--- 762,766 ----
# Get list of columns from items table
my %itemtypes;
! my %nullenabled;
$sth = $dbh->prepare("show columns from items");
$sth->execute;
***************
*** 764,767 ****
--- 768,772 ----
{
$itemtypes{$column} = $type;
+ $nullenabled{$column} = $null;
}
***************
*** 773,780 ****
my $sti =
$dbh->prepare(
! "alter table items change barcode barcode varchar(20) not null");
$sti->execute;
}
}
# extending the timestamp in branchtransfers...
--- 778,798 ----
my $sti =
$dbh->prepare(
! "alter table items change barcode barcode varchar(20)");
$sti->execute;
}
}
+ #
+ # dropping unique barcode index & setting barcode to null allowed.
+ #
+ $sth = $dbh->prepare("show index from items");
+ $sth->execute;
+ while ( my ( $table, $non_unique, $key_name, $Seq_in_index, $Column_name, $Collation, $cardinality, $sub_part, $Packed, $comment ) = $sth->fetchrow )
+ {
+ if ($key_name eq 'barcode' && $non_unique eq 0) {
+ print "dropping BARCODE index to enable empty barcodes\n";
+ $dbh->do("ALTER TABLE `items` DROP INDEX `barcode`");
+ }
+ }
+ $dbh->do("ALTER TABLE `items` CHANGE `barcode` `barcode` VARCHAR( 20 )") unless ($nullenabled{barcode} eq 'YES');
# extending the timestamp in branchtransfers...
***************
*** 897,900 ****
--- 915,922 ----
# $Log$
+ # Revision 1.59 2003/09/30 16:22:05 tipaul
+ # adding barcode NOT mandatory feature. Just run updatedatabase to get it.
+ # Note it's impossible to issue an item without barcode, as issue/returns is based on barcode...
+ #
# Revision 1.58 2003/07/16 04:08:29 acli
# Minor spelling correction
More information about the Koha-cvs
mailing list