diff --git a/lib/db/install.xml b/lib/db/install.xml
index 44da1fa..f45f015 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -287,7 +287,8 @@
         <FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="userid" NEXT="timeend"/>
         <FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="2147483647" SEQUENCE="false" PREVIOUS="timestart" NEXT="modifierid"/>
         <FIELD NAME="modifierid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timeend" NEXT="timemodified"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="modifierid"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="modifierid" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timemodified"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="enrolid"/>
@@ -2732,4 +2733,4 @@
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index 47beace..8f5208e 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -4741,6 +4741,16 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint(true, 2010071101);
     }
 
+    if ($oldversion < 2010071300) {
+        // Define field timecreated to be added to user_enrolments
+        $table = new xmldb_table('user_enrolments');
+        $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timemodified');
+
+        // Launch add field timecreated
+        $dbman->add_field($table, $field);
+
+        upgrade_main_savepoint(true, 2010071300);
+    }
 
     return true;
 }
diff --git a/lib/enrollib.php b/lib/enrollib.php
index b681ec4..f9e3667 100644
--- a/lib/enrollib.php
+++ b/lib/enrollib.php
@@ -856,6 +856,7 @@ abstract class enrol_plugin {
             $ue->timeend      = $timeend;
             $ue->modifier     = $USER->id;
             $ue->timemodified = time();
+            $ue->timecreated  = time();
             $ue->id = $DB->insert_record('user_enrolments', $ue);
 
             $inserted = true;
diff --git a/version.php b/version.php
index ef0dfcc..2d109e1 100644
--- a/version.php
+++ b/version.php
@@ -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 = 2010071200;  // YYYYMMDD   = date of the last version bump
+    $version = 2010071300;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 Preview 4+ (Build: 20100712)';  // Human-friendly version name
