Adding some new fields to biblioitems:
[koha_fer] / updater / updatedatabase
index f7ac5cc..26606ed 100755 (executable)
@@ -52,21 +52,6 @@ $|=1; # flushes output
 
 # Tables to add if they don't exist
 my %requiretables = (
-    categorytable       => "(categorycode char(5) NOT NULL default '',
-                             description text default '',
-                             itemtypecodes text default '',
-                             PRIMARY KEY (categorycode)
-                            )",
-    subcategorytable       => "(subcategorycode char(5) NOT NULL default '',
-                             description text default '',
-                             itemtypecodes text default '',
-                             PRIMARY KEY (subcategorycode)
-                            )",
-    mediatypetable       => "(mediatypecode char(5) NOT NULL default '',
-                             description text default '',
-                             itemtypecodes text default '',
-                             PRIMARY KEY (mediatypecode)
-                            )",
     action_logs     => "(
                     `timestamp` TIMESTAMP NOT NULL ,
                     `user` INT( 11 ) NOT NULL ,
@@ -175,10 +160,6 @@ my %requiretables = (
                             datereviewed datetime,
                             PRIMARY KEY (reviewid)
                             )",
-    borrowers_to_borrowers  => "(
-                            borrower1 integer,
-                            borrower2 integer
-                            )",
     subscriptionroutinglist=>"(
                              routingid integer NOT NULL auto_increment,
                              borrowernumber integer,
@@ -428,7 +409,7 @@ my %tabledata = (
             value               => '1',
             forceupdate         => { 'explanation' => 1,
                                      'type' => 1},
-            explanation         => 'Enable / Disable cloud link on OPAC',
+            explanation         => 'Enable / Disable cloud link on OPAC (Require to run misc/cronjobs/build_browser_and_cloud.pl on the server)',
             type                => 'YesNo',
         },
        {
@@ -437,7 +418,7 @@ my %tabledata = (
             value               => '1',
             forceupdate         => { 'explanation' => 1,
                                      'type' => 1},
-            explanation         => 'Enable/Disable browser link on OPAC (needs to set misc/cronjob/build_browser.pl)',
+            explanation         => 'Enable/Disable browser link on OPAC (Require to run misc/cronjobs/build_browser_and_cloud.pl on the server)',
             type                => 'YesNo',
         },
        {
@@ -538,6 +519,14 @@ my %tabledata = (
             explanation         => "Enter a specific hash for NoZebra indexes. Enter : 'indexname' => '100a,245a,500*','index2' => '...'",
             type                => 'Free',
         },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'uppercasesurnames',
+            value               => '0',
+            forceupdate         => {'explanation' => 1, 'type' => 1},
+            explanation         => "Force Surnames to be uppercase",
+            type                => 'YesNo',
+        },
     ],
     userflags => [
         {
@@ -566,7 +555,7 @@ my %tabledata = (
         {
             uniquefieldrequired => 'id',
             category            => 'SUGGEST',
-            authorised_value    => 'Not enoug budget',
+            authorised_value    => 'Not enough budget',
             lib                 => 'This book it too much expensive',
         }
     ],
@@ -596,7 +585,7 @@ my %fielddefinitions = (
             field    => 'id',
             type    => 'int(11)',
             null    => 'NOT NULL',
-            key        => '',
+            key        => 'PRI',
             default    => '',
             extra    => 'auto_increment',
         },
@@ -743,6 +732,65 @@ my %fielddefinitions = (
             default    => '',
             extra    => '',
         },
+        {
+            field   => 'dewey',
+            type    => 'varchar(30)',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'publicationyear',
+            type    => 'text',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'collectiontitle',
+            type    => 'mediumtext',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'collectionissn',
+            type    => 'mediumtext',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'collectionvolume',
+            type    => 'mediumtext',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'editionstatement',
+            type    => 'text',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+        {
+            field   => 'editionresponsability',
+            type    => 'text',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
+              
+    ],
+    deletedbiblioitems => [
+        {
+            field   => 'dewey',
+            type    => 'varchar(30)',
+            null    => 'null',
+            default => '',
+            extra   => '',
+        },
     ],
     branches =>  [
         {
@@ -941,6 +989,14 @@ my %fielddefinitions = (
             extra    => '',
         },
         {
+            field    => 'homebranch',
+            type    => 'varchar(10)',
+            null    => 'NULL',
+            key        => '',
+            default    => '',
+            extra    => '',
+        },
+        {
             field    => 'holdingbranch',
             type    => 'varchar(10)',
             null    => 'NULL',
@@ -974,6 +1030,15 @@ my %fielddefinitions = (
             extra  => '',
         },
     ],
+    marc_breeding => [
+        {
+            field => 'marc',
+            type  => 'LONGBLOB',
+            null  => 'NULL',
+            key    => '',
+            extra  => '',
+        }
+    ],
     marc_subfield_structure => [
         {
             field => 'defaultvalue',
@@ -1098,7 +1163,26 @@ my %indexes = (
         {
             indexname => 'branchcode',
             content   => 'branchcode',
-    
+            type => 'PRI',
+        }
+    ],
+    branchrelations => [
+        {
+            indexname => 'PRIMARY',
+            content => 'categorycode',
+            type => 'PRI',
+        }
+    ],
+    branchrelations => [
+        {    indexname => 'PRIMARY',
+            content => 'branchcode,categorycode',
+            type => 'PRI',
+        },
+        {    indexname => 'branchcode',
+            content => 'branchcode',
+        },
+        {    indexname => 'categorycode',
+            content => 'categorycode',
         }
     ],
     currency => [
@@ -1152,6 +1236,20 @@ my %foreign_keys = (
 #            onDelete => 'CASCADE|SET NULL|NO ACTION| RESTRICT',
 #         }
 #    ],
+    branchrelations => [
+        {    key => 'branchcode',
+            foreigntable => 'branches',
+            foreignkey => 'branchcode',
+            onUpdate => 'CASCADE',
+            onDelete => 'CASCADE',
+        },
+        {    key => 'categorycode',
+            foreigntable => 'branchcategories',
+            foreignkey => 'categorycode',
+            onUpdate => 'CASCADE',
+            onDelete => 'CASCADE',
+        },
+    ],
     shelfcontents => [
         {    key => 'shelfnumber',
             foreigntable => 'bookshelf',
@@ -1538,14 +1636,14 @@ my %column_change = (
 $sth = $dbh->prepare("show table status");
 $sth->execute;
 while ( my $table = $sth->fetchrow_hashref ) {
-     if ($table->{Engine} ne 'InnoDB') {
-         $dbh->do("ALTER TABLE $table->{Name} TYPE = innodb");
-         print "moving $table->{Name} to InnoDB\n";
-     }
     next if $table->{Name} eq 'marc_word';
     next if $table->{Name} eq 'marc_subfield_table';
     next if $table->{Name} eq 'auth_word';
     next if $table->{Name} eq 'auth_subfield_table';
+     if ($table->{Engine} ne 'InnoDB') {
+         $dbh->do("ALTER TABLE $table->{Name} TYPE = innodb");
+         print "moving $table->{Name} to InnoDB\n";
+     }
     unless ($table->{Collation} =~ /^utf8/) {
          print "moving $table->{Name} to utf8\n";
         $dbh->do("ALTER TABLE $table->{Name} CONVERT TO CHARACTER SET utf8");
@@ -2001,6 +2099,39 @@ $sth->finish;
 exit;
 
 # $Log$
+# Revision 1.172  2007/07/19 10:21:22  hdl
+# Adding some new fields to biblioitems:
+# collectiontitle
+# collectionissn
+# collectionvolume
+#
+#
+# Changing publicationyear to text.
+#
+# Revision 1.171  2007/07/02 02:30:16  rangi
+# Fix for bug 1296, making surnames uppercase a systems preference
+#
+# Revision 1.170  2007/06/26 13:25:37  tipaul
+# removing some useless tables from updatedatabase
+#
+# Revision 1.169  2007/06/26 09:23:26  tipaul
+# improving OpacBrowser systempref explanation
+#
+# Revision 1.168  2007/06/25 15:02:31  tipaul
+# missing field declaration
+#
+# Revision 1.167  2007/06/15 13:09:08  toins
+# bugfix : bibliotitems.dewey & deletedbiblioitems.dewey mustn't be double(8,6).
+#
+# Revision 1.166  2007/06/08 09:40:12  toins
+# bug fix : items.homebranch must be VARCHAR(10)
+#
+# Revision 1.165  2007/05/23 16:33:10  tipaul
+# skip move to innoDB for the 4 22 tables, that are used to store MARC records, are useless in Koha 3.0 The process is very very long, so the updatedatabase should speed up a lot (by long I mean 1 hour on my Dual core with SCSI disk, for a 50 000 biblios long table
+#
+# Revision 1.164  2007/05/04 16:24:09  tipaul
+# various bugfixes on parameters modules + adding default NoZebraIndexes systempreference if it's empty
+#
 # Revision 1.163  2007/05/02 16:44:31  tipaul
 # NoZebra SQL index management :
 # * adding 3 subs in Biblio.pm