Skip to content
Browse files

MDL-30643 added tables to upgrade script

  • Loading branch information...
1 parent 6b1a2e4 commit 7d2705568ec28440efa90dce351abd327d969f16 @nebgor nebgor committed
Showing with 55 additions and 3 deletions.
  1. +2 −2 lib/db/install.xml
  2. +52 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
4 lib/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20121102" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20121112" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -2931,4 +2931,4 @@
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
View
52 lib/db/upgrade.php
@@ -1414,5 +1414,57 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012110700.01);
}
+ if ($oldversion < 2012111200.00) {
+
+ // Define table temp_enroled_template to be created
+ $table = new xmldb_table('temp_enroled_template');
+
+ // Adding fields to table temp_enroled_template
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('roleid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table temp_enroled_template
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table temp_enroled_template
+ $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
+ $table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
+ $table->add_index('roleid', XMLDB_INDEX_NOTUNIQUE, array('roleid'));
+
+ // Conditionally launch create table for temp_enroled_template
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Define table temp_log_template to be created
+ $table = new xmldb_table('temp_log_template');
+
+ // Adding fields to table temp_log_template
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('course', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('action', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table temp_log_template
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table temp_log_template
+ $table->add_index('action', XMLDB_INDEX_NOTUNIQUE, array('action'));
+ $table->add_index('course', XMLDB_INDEX_NOTUNIQUE, array('course'));
+ $table->add_index('user', XMLDB_INDEX_NOTUNIQUE, array('userid'));
+ $table->add_index('usercourseaction', XMLDB_INDEX_NOTUNIQUE, array('userid', 'course', 'action'));
+
+ // Conditionally launch create table for temp_log_template
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2012111200.00);
+ }
+
+
return true;
}
View
2 version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012110900.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012111200.00; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit 7d27055

Please sign in to comment.
Something went wrong with that request. Please try again.