Bug 5668 follow-up: DBRev number
[koha_fer] / installer / data / mysql / updatedatabase.pl
index fae6351..25e3543 100755 (executable)
@@ -4929,7 +4929,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowPKIAuth','None','Use the field from a client-side SSL certificate to look a user in the Koha database','None|Common Name|emailAddress','Choice');
     });
     print "Upgrade to $DBversion done (Bug 6296 New System preference AllowPKIAuth)\n";
-    SetVersion($DBversion);
 }
 
 $DBversion = "3.07.00.029";
@@ -5159,7 +5158,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
-$DBversion = "3.07.00.XXX";
+$DBversion = "3.07.00.047";
 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     $dbh->do("CREATE INDEX items_location ON items(location)");
     $dbh->do("CREATE INDEX items_ccode ON items(ccode)");
@@ -5167,6 +5166,30 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.07.00.048";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do(
+        q | CREATE TABLE ratings (
+  borrowernumber int(11) NOT NULL,
+  biblionumber int(11) NOT NULL,
+  rating_value tinyint(1) NOT NULL,
+  timestamp timestamp NOT NULL default CURRENT_TIMESTAMP,
+  PRIMARY KEY  (borrowernumber,biblionumber),
+  CONSTRAINT ratings_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT ratings_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+    );
+
+    $dbh->do(
+q /INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','disable',NULL,'disable|all|details','Choice') /
+    );
+
+    print
+"Upgrade to $DBversion done (Add 'ratings' table and 'OpacStarRatings' syspref)\n";
+    SetVersion($DBversion);
+}
+
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)