[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/updater updatedatabase [rel_2_2]
From: |
paul poulain |
Subject: |
[Koha-cvs] koha/updater updatedatabase [rel_2_2] |
Date: |
Fri, 30 Dec 2005 11:13:29 +0000 |
CVSROOT: /cvsroot/koha
Module name: koha
Branch: rel_2_2
Changes by: paul poulain <address@hidden> 05/12/30 11:13:29
Modified files:
updater : updatedatabase
Log message:
* tool to synchronise TABLE and deletedTABLE structures in
updatedatabase
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/updater/updatedatabase.diff?only_with_tag=rel_2_2&tr1=1.100.2.15&tr2=1.100.2.16&r1=text&r2=text
Patches:
Index: koha/updater/updatedatabase
diff -u koha/updater/updatedatabase:1.100.2.15
koha/updater/updatedatabase:1.100.2.16
--- koha/updater/updatedatabase:1.100.2.15 Mon Dec 5 09:50:35 2005
+++ koha/updater/updatedatabase Fri Dec 30 11:13:29 2005
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: updatedatabase,v 1.100.2.15 2005/12/05 09:50:35 tipaul Exp $
+# $Id: updatedatabase,v 1.100.2.16 2005/12/30 11:13:29 tipaul Exp $
# Database Updater
# This script checks for required updates to the database.
@@ -1424,6 +1424,7 @@
$dbh->do('ALTER TABLE marc_subfield_structure drop primary key');
$dbh->do('ALTER TABLE marc_subfield_structure ADD PRIMARY KEY ( frameworkcode,
tagfield, tagsubfield )');
+$dbh->do("alter table marc_subfield_table change tagorder tagorder int not
null default '1'");
# Get list of columns from marc_word table
my %marc_word;
my %nullenabled;
@@ -1445,6 +1446,36 @@
}
# Populate tables with required data
+
+# synch table and deletedtable.
+foreach my $table (('borrowers','items','biblio','biblioitems')) {
+ my %deletedborrowers;
+ print "synch'ing $table\n";
+ $sth = $dbh->prepare("show columns from deleted$table");
+ $sth->execute;
+ while ( my ( $column, $type, $null, $key, $default, $extra ) =
$sth->fetchrow ) {
+ $deletedborrowers{$column}=1;
+ }
+ $sth = $dbh->prepare("show columns from $table");
+ $sth->execute;
+ my $previous;
+ while ( my ( $column, $type, $null, $key, $default, $extra ) =
$sth->fetchrow ) {
+ unless ($deletedborrowers{$column}) {
+ my $newcol="alter table deleted$table add $column
$type";
+ if ($null eq 'YES') {
+ $newcol .= " NULL ";
+ } else {
+ $newcol .= " NOT NULL ";
+ }
+ $newcol .= "default $default" if $default;
+ $newcol .= " after $previous" if $previous;
+ $previous=$column;
+ print "creating column $column\n";
+ $dbh->do($newcol);
+ }
+ }
+}
+
# fill aqbasket if it's empty and aqorder is not
# => it means it has just been created & must be filled
$sth = $dbh->prepare("select count(*) from aqbasket");
@@ -1538,6 +1569,9 @@
exit;
# $Log: updatedatabase,v $
+# Revision 1.100.2.16 2005/12/30 11:13:29 tipaul
+# * tool to synchronise TABLE and deletedTABLE structures in updatedatabase
+#
# Revision 1.100.2.15 2005/12/05 09:50:35 tipaul
# New systempreference : OpacPasswordChange if set to Yes (default) the user
can change it's password. If set to No, he can't. Useful for libraries with
LDAP auth, where the password is checked in LDAP, not in Koha, thus Koha can't
change it
#
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/updater updatedatabase [rel_2_2],
paul poulain <=