koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/updater updatedatabase [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha/updater updatedatabase [rel_3_0]
Date: Tue, 14 Nov 2006 14:39:32 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        06/11/14 14:39:32

Modified files:
        updater        : updatedatabase 

Log message:
        * delete the userflags "reservforself" which is unused.
        * some new function not use at the moment.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_3_0&r1=1.157.2.16&r2=1.157.2.17

Patches:
Index: updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.157.2.16
retrieving revision 1.157.2.17
diff -u -b -r1.157.2.16 -r1.157.2.17
--- updatedatabase      2 Nov 2006 09:27:30 -0000       1.157.2.16
+++ updatedatabase      14 Nov 2006 14:39:31 -0000      1.157.2.17
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.157.2.16 2006/11/02 09:27:30 toins Exp $
+# $Id: updatedatabase,v 1.157.2.17 2006/11/14 14:39:31 toins Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -743,6 +743,16 @@
                        extra   => '',
                },
        ],
+       suggestions => [
+           {
+               field   => 'reason',
+               type    => 'text',
+               null    => 'NULL',
+               key     => ''  ,
+               default => '',
+               extra   =>      '',
+           }
+       ],
 );
 
 my %indexes = (
@@ -1280,6 +1290,45 @@
        }
 }
 
+# Enter here the field you want to delete from DB.
+# FIXME :: there is a %uselessfield before which seems doing the same things.
+my %fieldtodelete = (
+    # tablename => [fieldname1,fieldname2,...]
+
+); # %fielddelete
+
+print "removing some unused fields...\n";
+foreach my $table ( keys %fieldtodelete ) {
+    foreach my $field ( @{$fieldtodelete{$table}} ){
+        print "removing ".$field." from ".$table;
+        my $sth = $dbh->prepare("ALTER TABLE $table DROP $field");
+        $sth->execute;
+        if ( $sth->err ) {
+            print "Error : $sth->errstr \n";
+        }
+    }
+}
+
+# Enter here the line you want to remove from DB.
+my %linetodelete = (
+    # table name => where clause.
+    userflags => "bit = 8", # delete the 'reserveforself' flags
+    
+); # %linetodelete
+
+print "removing some unused data...\n";
+foreach my $table ( keys %linetodelete ) {
+    foreach my $where ( @{linetodelete{$table}} ){
+        print "DELETE FROM ".$table." where ".$where;
+        my $sth = $dbh->prepare("DELETE FROM $table where $where");
+        $sth->execute;
+        if ( $sth->err ) {
+            print "Error : $sth->errstr \n";
+        }
+    }
+}
+
+
 #-------------------
 # Initialize
 
@@ -1875,6 +1924,10 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.157.2.17  2006/11/14 14:39:31  toins
+# * delete the userflags "reservforself" which is unused.
+# * some new function not use at the moment.
+#
 # Revision 1.157.2.16  2006/11/02 09:27:30  toins
 # issue.branchcode must be varchar(10).
 #




reply via email to

[Prev in Thread] Current Thread [Next in Thread]