From 20131e5cddd9b070b58e853d0649d40ebe9ac947 Mon Sep 17 00:00:00 2001
From: Ankit Agarwal <ankit@moodle.com>
Date: Mon, 19 Nov 2012 13:17:24 +0800
Subject: [PATCH] MDL-36614 calendar: upgrade code for adding eventtype field
 to all existing installs

---
 lib/db/upgrade.php | 14 ++++++++++++++
 version.php        |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index 65c304649ad..acd035a0c7e 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -1472,6 +1472,20 @@ function xmldb_main_upgrade($oldversion) {
         // Main savepoint reached.
         upgrade_main_savepoint(true, 2012111200.01);
     }
+    if ($oldversion < 2012111601.01) {
+
+        // Define field eventtype to be added to event_subscriptions.
+        $table = new xmldb_table('event_subscriptions');
+        $field = new xmldb_field('eventtype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, 'userid');
+
+        // Conditionally launch add field eventtype.
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2012111601.01);
+    }
 
 
     return true;
diff --git a/version.php b/version.php
index 87c44901a67..0e2b56e4a01 100644
--- a/version.php
+++ b/version.php
@@ -30,7 +30,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$version  = 2012111601.00;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012111601.01;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes