From: Francois Marier <francois@catalyst.net.nz>
Date: Wed, 24 Oct 2007 03:33:39 +0000 (+1300)
Subject: question/type/rqp/db upgrade: add the 'question_rqp_servers' table
X-Git-Url: http://gitprivate/gw?p=moodle-r2.git;a=commitdiff_plain;h=d2c8d7abfbff173c2bd669e5b572e25d6e2d98b4;hp=058e0c167316ce06aa3a67bbd93c983026973de5

question/type/rqp/db upgrade: add the 'question_rqp_servers' table
The 'mdl_question_rqp_servers' table is created during fresh installs, but it was missing from the upgrade script.
---

diff --git a/question/type/rqp/db/upgrade.php b/question/type/rqp/db/upgrade.php
index 394d982..041fd89 100644
--- a/question/type/rqp/db/upgrade.php
+++ b/question/type/rqp/db/upgrade.php
@@ -23,14 +23,20 @@ function xmldb_qtype_rqp_upgrade($oldversion=0) {
 
     $result = true;
 
-/// And upgrade begins here. For each one, you'll need one 
-/// block of code similar to the next one. Please, delete 
-/// this comment lines once this file start handling proper
-/// upgrade code.
-
-/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
-///     $result = result of "/lib/ddllib.php" function calls
-/// }
+    if ($result && $oldversion < 2006032201) {
+        $table = new XMLDBTable('question_rqp_servers');
+
+        $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
+        $table->addFieldInfo('typeid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+        $table->addFieldInfo('url', XMLDB_TYPE_CHAR, 255);
+        $table->addFieldInfo('can_render', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+        $table->addFieldInfo('can_author', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+
+        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+        $table->addKeyInfo('typeid', XMLDB_KEY_FOREIGN, array('typeid'), 'rqp_types', array('id'));
+
+        $result = $result && create_table($table);
+    }
 
     return $result;
 }
diff --git a/question/type/rqp/version.php b/question/type/rqp/version.php
index 2d2a8d9..096caed 100644
--- a/question/type/rqp/version.php
+++ b/question/type/rqp/version.php
@@ -1,6 +1,6 @@
 <?PHP // $Id: version.php,v 1.1 2006/03/24 19:31:48 gustav_delius Exp $
 
-$plugin->version  = 2006032200;
+$plugin->version  = 2006032201;
 $plugin->requires = 2006032200;
 
 ?>
