[Koha-cvs] koha/updater updatedatabase

Antoine Farnault antoine at koha-fr.org
Mon Jul 17 14:51:48 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Antoine Farnault <toins>	06/07/17 12:51:48

Modified files:
	updater        : updatedatabase 

Log message:
	auto_increment id in aqbooksellers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&r1=1.154&r2=1.155

Patches:
Index: updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -b -r1.154 -r1.155
--- updatedatabase	17 Jul 2006 12:28:45 -0000	1.154
+++ updatedatabase	17 Jul 2006 12:51:48 -0000	1.155
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.154 2006/07/17 12:28:45 toins Exp $
+# $Id: updatedatabase,v 1.155 2006/07/17 12:51:48 toins Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -849,15 +849,23 @@
 		},
 	],
 	aqbooksellers =>  [
-		{
+{
+            field   => 'id',
+            type    => 'int(11)',
+            null    => 'NOT NULL',
+            key     => '',
+            default => '',
+            extra   => 'auto_increment',
+},
+{
 			field	=> 'listprice',
 			type	=> 'varchar(10)',
 			null	=> 'NULL',
 			key		=> '',
 			default	=> '',
 			extra	=> '',
-		},
-		{
+},
+{
 			field	=> 'invoiceprice',
 			type	=> 'varchar(10)',
 			null	=> 'NULL',
@@ -1716,13 +1724,14 @@
 				$action="add";
 			}
 # if it's a primary key, drop the previous pk, before altering the table
-			my $sth;
-			if ($key ne 'PRIMARY KEY') {
-				$sth =$dbh->prepare("alter table $table $action $field $type $null $key $extra default ? $after");
-			} else {
-				$sth =$dbh->prepare("alter table $table drop primary key, $action $field $type $null $key $extra default ? $after");
-			}
-			$sth->execute($default);
+# 			my $sth;
+   my $request = "alter table $table ";
+    $request.=" drop primary key" if $key eq 'PRIMARY KEY';
+    $request.= " $action $field $type $null $key $extra ";
+    $request.= "default ".$dbh->quote($default) if $default;
+    $request.= " $after";
+#    print "REQ : $request";
+			$dbh->do($request);
 			print "  alter or create $field in $table\n" unless $silent;
 		}
 	}
@@ -2164,8 +2173,8 @@
 exit;
 
 # $Log: updatedatabase,v $
-# Revision 1.154  2006/07/17 12:28:45  toins
-# sync with rel_2_2
+# Revision 1.155  2006/07/17 12:51:48  toins
+# auto_increment id in aqbooksellers
 #
 # Revision 1.153  2006/07/04 14:36:52  toins
 # Head & rel_2_2 merged





More information about the Koha-cvs mailing list