]> git.mjollnir.org Git - moodle.git/commitdiff
version bump: introducing cache_flags table to store volatile time-bound flags
authormartinlanghoff <martinlanghoff>
Tue, 2 Oct 2007 08:38:19 +0000 (08:38 +0000)
committermartinlanghoff <martinlanghoff>
Tue, 2 Oct 2007 08:38:19 +0000 (08:38 +0000)
We are intending to use them for dirty context paths, lightweight
session entries for auth/ldap, and other similar uses...

MDL-11347

lib/db/install.xml
lib/db/upgrade.php
version.php

index 4338e39d4fbab887bfb1f4883987bc29d48353c3..07db7edca05099839ea1d0cde81fc248b14aa4bc 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20070928" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20071001" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <INDEX NAME="script-value" UNIQUE="false" FIELDS="script, value" COMMENT="index used for key validation"/>
       </INDEXES>
     </TABLE>
-    <TABLE NAME="grade_letters" COMMENT="Repository for grade letters, for courses and other moodle entities that use grades." PREVIOUS="user_private_key">
+    <TABLE NAME="grade_letters" COMMENT="Repository for grade letters, for courses and other moodle entities that use grades." PREVIOUS="user_private_key" NEXT="cache_flags">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="contextid"/>
         <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="What contextid does this letter apply to (for now these will always be courses, but later...)" PREVIOUS="id" NEXT="lowerboundary"/>
         <INDEX NAME="contextid-lowerboundary" UNIQUE="false" FIELDS="contextid, lowerboundary" COMMENT="index used when fetching context letters"/>
       </INDEXES>
     </TABLE>
+    <TABLE NAME="cache_flags" COMMENT="Cache of time-sensitive flags" PREVIOUS="grade_letters">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="flagtype"/>
+        <FIELD NAME="flagtype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="flagtype" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="value"/>
+        <FIELD NAME="value" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="expiry"/>
+        <FIELD NAME="expiry" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="value"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+      </KEYS>
+      <INDEXES>
+        <INDEX NAME="typename" UNIQUE="true" FIELDS="flagtype, name"/>
+      </INDEXES>
+    </TABLE>
   </TABLES>
   <STATEMENTS>
     <STATEMENT NAME="insert mnet_application" TYPE="insert" TABLE="mnet_application" COMMENT="Initial insert of records on table mnet_application" NEXT="insert log_display">
index 841c67c68251a4c06482cea72fee3e547b212cf1..b33c07f1efa0314c2943f25119c607dcd923bcfb 100644 (file)
@@ -2256,6 +2256,31 @@ function xmldb_main_upgrade($oldversion=0) {
         }
     }
 
+    if ($result && $oldversion < 2007100100) {
+
+
+    /// Define table cache_flags to be created
+        $table = new XMLDBTable('cache_flags');
+
+    /// Adding fields to table cache_flags
+        $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
+        $table->addFieldInfo('flagtype', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
+        $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
+        $table->addFieldInfo('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
+        $table->addFieldInfo('value', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
+        $table->addFieldInfo('expiry', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
+
+    /// Adding keys to table cache_flags
+        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+    /// Adding indexes to table cache_flags
+        $table->addIndexInfo('typename', XMLDB_INDEX_UNIQUE, array('flagtype', 'name'));
+
+    /// Launch create table for cache_flags
+        $result = $result && create_table($table);
+    }
+
+
 /*
     /// drop old gradebook tables
     if ($result && $oldversion < xxxxxxxx) {
index 9fda03bfe75d76fb60b27557c0a54a3b95b9104b..8ab6d8b86174003c6762351301eba1d83a7fc7d8 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2007092807;  // YYYYMMDD = date
+    $version = 2007100100;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '1.9 Beta +';   // Human-friendly version name