* removing too verbose messages.
authortipaul <tipaul>
Fri, 28 Nov 2003 10:08:33 +0000 (10:08 +0000)
committertipaul <tipaul>
Fri, 28 Nov 2003 10:08:33 +0000 (10:08 +0000)
* creating a fulltext index on bibliothesaurus

updater/updatedatabase

index e868b16..dbb663f 100755 (executable)
@@ -24,7 +24,7 @@ use C4::Context;
 # FIXME - The user might be installing a new database, so can't rely
 # on /etc/koha.conf anyway.
 
-my $debug = 1;
+my $debug = 0;
 
 my (
     $sth, $sti,
@@ -38,6 +38,7 @@ my (
 );
 
 my $dbh = C4::Context->dbh;
+print "connected to your DB. Checking & modifying it\n";
 
 #-------------------
 # Defines
@@ -623,9 +624,8 @@ while ( my ($table) = $sth->fetchrow ) {
 
 # Now add any missing tables
 foreach $table ( keys %requiretables ) {
-    print "Checking $table table...\n" if $debug;
     unless ( $existingtables{$table} ) {
-        print "Adding $table table...\n";
+       print "Adding $table table...\n";
         my $sth = $dbh->prepare("create table $table $requiretables{$table}");
         $sth->execute;
         if ( $sth->err ) {
@@ -637,13 +637,13 @@ foreach $table ( keys %requiretables ) {
 
 # now drop useless tables
 foreach $table ( keys %dropable_table ) {
-    print "Dropping unused tables...\n" if $debug;
-    if ( $existingtables{$table} ) {
-        $dbh->do("drop table $table");
-        if ( $dbh->err ) {
-            print "Error : $dbh->errstr \n";
-        }
-    }
+       if ( $existingtables{$table} ) {
+               print "Dropping unused table $table\n" if $debug;
+               $dbh->do("drop table $table");
+               if ( $dbh->err ) {
+                       print "Error : $dbh->errstr \n";
+               }
+       }
 }
 unless ( $existingtables{'z3950servers'} ) {
        #MJR: added syntax entries to close bug 624
@@ -830,6 +830,21 @@ while ( my ( $table, $non_unique, $key_name, $Seq_in_index, $Column_name, $Colla
 }
 $dbh->do("ALTER TABLE `items` CHANGE `barcode` `barcode` VARCHAR( 20 )") unless ($nullenabled{barcode} eq 'YES');
 
+#
+# creating fulltext index in bibliothesaurus if needed
+#
+$sth = $dbh->prepare("show index from bibliothesaurus");
+$sth->execute;
+my $exists=0;
+while ( my ( $table, $non_unique, $key_name, $Seq_in_index, $Column_name, $Collation, $cardinality, $sub_part, $Packed, $comment ) = $sth->fetchrow )
+{
+       if ($key_name eq 'category_2') {
+               $exists=1;
+       }
+}
+print "Creating fulltext index on bibliothesaurus\n" unless $exists;
+$dbh->do('create fulltext index category_2 on bibliothesaurus (category,freelib)') unless $exists;
+
 # changing z3950daemon field to NULL in marc_breeding
 $dbh->do("ALTER TABLE `marc_breeding` CHANGE `z3950random` `z3950random` VARCHAR( 40 )");
 
@@ -955,6 +970,10 @@ $sth->finish;
 exit;
 
 # $Log$
+# Revision 1.67  2003/11/28 10:08:33  tipaul
+# * removing too verbose messages.
+# * creating a fulltext index on bibliothesaurus
+#
 # Revision 1.66  2003/11/12 16:14:42  slef
 # lengthen cardnumber to 16 and make it unique
 #