<DBMIGRATION type="lib" VERSION="2005120100">
  <TABLES>
    <TABLE name="config">
      <FIELDS>
        <FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
        <FIELD name="value" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_config_value(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="config_plugins">
      <FIELDS>
        <FIELD name="plugin" method="NO_CONV" type="varchar" length="100" dropindex="plugin_name" default="core"/>
        <FIELD name="name" method="NO_CONV" type="varchar" length="100" adduniqueindex="plugin_name(plugin(100), name(100))"/>
        <FIELD name="value" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_config_plugins_value(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="course_allowed_modules" />
    <TABLE name="course_display" />
    <TABLE name="course_meta" />
    <TABLE name="course_modules" />
    <TABLE name="course_categories">
      <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
          <PHP_FUNCTION>
            migrate2utf8_course_categories_name(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_categories_description(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="path" method="NO_CONV" type="varchar" length="255" />
      </FIELDS>
    </TABLE>
    <TABLE name="course_sections">
      <FIELDS>
        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_sections_summary(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="sequence" method="NO_CONV" type="text" length="0" />
      </FIELDS>
    </TABLE>
    <TABLE name="course_request">
      <FIELDS>
        <FIELD name="fullname" method="PHP_FUNCTION" type="varchar" length="254">
          <PHP_FUNCTION>
            migrate2utf8_course_request_fullname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="shortname" method="PHP_FUNCTION" type="varchar" length="15" dropindex="shortname" addindex="shortname(shortname(15))">
          <PHP_FUNCTION>
            migrate2utf8_course_request_shortname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_request_summary(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="reason" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_request_reason(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
          <PHP_FUNCTION>
            migrate2utf8_course_request_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="event">
      <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
          <PHP_FUNCTION>
            migrate2utf8_event_name(RECORDID);
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_event_description(RECORDID);
          </PHP_FUNCTION>
        </FIELD>
          <FIELD name="modulename" method="NO_CONV" type="varchar" length="20" />
          <FIELD name="eventtype" method="NO_CONV" type="varchar" length="20" />
          <FIELD name="uuid" method="NO_CONV" type="varchar" length="36" />
      </FIELDS>
    </TABLE>
    <TABLE name="cache_filters">
      <FIELDS>
        <FIELD name="md5key" method="NO_CONV" type="varchar" length="32"  dropindex="filtermd5key"/>
        <FIELD name="filter" method="NO_CONV" type="varchar" length="32"  addindex="filtermd5key(filter(32),md5key(32))"/>
        <FIELD name="rawtext" method="NO_CONV" type="text" length="0" />
      </FIELDS>
    </TABLE>
    <TABLE name="cache_text">
      <FIELDS>
        <FIELD name="md5key" method="NO_CONV" type="varchar" length="32" dropindex="md5key" addindex="md5key(md5key(32))"/>
        <FIELD name="formattedtext" method="NO_CONV" type="longtext" length="0" />
      </FIELDS>
    </TABLE>
    <TABLE name="grade_item" />
    <TABLE name="grade_preferences" />
    <TABLE name="grade_category">
       <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="64">
          <PHP_FUNCTION>
            migrate2utf8_grade_category_name(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
       </FIELDS>
    </TABLE>
    <TABLE name="grade_exceptions" />
    <TABLE name="grade_letter">
      <FIELDS>
        <FIELD name="letter" method="PHP_FUNCTION" type="varchar" length="8" default="NA">
          <PHP_FUNCTION>
            migrate2utf8_grade_letter_letter(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="groups_members" />
    <TABLE name="groups">
      <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="254">
          <PHP_FUNCTION>
            migrate2utf8_groups_name(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_groups_description(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
          <PHP_FUNCTION>
            migrate2utf8_groups_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10" default="en">
          <PHP_FUNCTION>
            migrate2utf8_groups_lang(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="log">
      <FIELDS>
        <FIELD name="ip" method="NO_CONV" type="varchar" length="15" dropindex="timecoursemoduleaction"/>
        <FIELD name="module" method="NO_CONV" type="varchar" length="20" dropindex="coursemoduleaction"/>
        <FIELD name="action" method="NO_CONV" type="varchar" length="15"  addindex="timecoursemoduleaction(time, course, module(20), action(15))" />
        <FIELD name="url" method="NO_CONV" type="varchar" length="100" addindex="coursemoduleaction(course, module(20), action(15))" />
        <FIELD name="info" method="NO_CONV" type="varchar" length="255" />
      </FIELDS>
    </TABLE>
    <TABLE name="log_display">
      <FIELDS>
        <FIELD name="module" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="action" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="mtable" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="field" method="NO_CONV" type="varchar" length="40" />
      </FIELDS>
    </TABLE>
    <TABLE name="message_contacts" />
    <TABLE name="message">
      <FIELDS>
        <FIELD name="message" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_message_message(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="messagetype" method="NO_CONV" type="varchar" length="50" />
      </FIELDS>
    </TABLE>
    <TABLE name="message_read">
      <FIELDS>
        <FIELD name="message" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_message_read_message(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="messagetype" method="NO_CONV" type="varchar" length="50" />
      </FIELDS>
    </TABLE>
    <TABLE name="modules">
      <FIELDS>
          <FIELD name="name" method="NO_CONV" type="varchar" length="20" dropindex="name" addindex="name(name(20))"/>
          <FIELD name="search" method="PHP_FUNCTION" type="varchar" length="255">
           <PHP_FUNCTION>
             migrate2utf8_modules_search(RECORDID)
           </PHP_FUNCTION>        
          </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="scale">
      <FIELDS>
        <FIELD name="name" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
          <SQL_DETECT_USER>
            SELECT s.userid
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
            SELECT s.courseid as course
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
        <FIELD name="scale" method="PLAIN_SQL_UPDATE" type="text" length="0">
          <SQL_DETECT_USER>
            SELECT s.userid
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
            SELECT s.courseid as course
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
        <FIELD name="description" method="PLAIN_SQL_UPDATE" type="text" length="0">
          <SQL_DETECT_USER>
            SELECT s.userid
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
            SELECT s.courseid as course
            FROM {$CFG->prefix}scale s
            WHERE s.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="sessions">
      <FIELDS>
        <FIELD name="sesskey" method="NO_CONV" type="varchar" length="32" dropprimary="true" addprimary="(sesskey(32))"/>
        <FIELD name="expireref" method="NO_CONV" type="varchar" length="64" />
        <FIELD name="data" method="NO_CONV" type="text" length="0" />
      </FIELDS>
    </TABLE>
    <TABLE name="timezone">
      <FIELDS>
        <FIELD name="name" method="NO_CONV" type="varchar" length="100" />
        <FIELD name="rule" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="dst_time" method="NO_CONV" type="varchar" length="5" />
        <FIELD name="std_time" method="NO_CONV" type="varchar" length="5" />
      </FIELDS>
    </TABLE>
    <TABLE name="user_students">
      <FIELDS>
        <FIELD name="enrol" method="NO_CONV" type="varchar" length="20" dropindex="enrol" addindex="enrol(enrol(20))"/>
      </FIELDS>
    </TABLE>
    <TABLE name="user_teachers">
      <FIELDS>
        <FIELD name="role" method="PLAIN_SQL_UPDATE" type="varchar" length="40">
          <SQL_DETECT_USER>
            SELECT ut.userid
            FROM {$CFG->prefix}user_teachers ut
            WHERE ut.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
            SELECT ut.course
            FROM {$CFG->prefix}user_teachers ut
            WHERE ut.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
        <FIELD name="enrol" method="NO_CONV" type="varchar" length="20" dropindex="enrol" addindex="enrol(enrol(20))"/>
      </FIELDS>
    </TABLE>
    <TABLE name="stats_daily" />
    <TABLE name="stats_weekly" />
    <TABLE name="stats_monthly" />
    <TABLE name="stats_user_daily">
      <FIELDS>
        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
      </FIELDS>
    </TABLE>
    <TABLE name="stats_user_monthly">
      <FIELDS>
        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
      </FIELDS>
    </TABLE>
    <TABLE name="stats_user_weekly">
      <FIELDS>
        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
      </FIELDS>
    </TABLE>
    <TABLE name="user_preferences">
      <FIELDS>
        <FIELD name="name" method="NO_CONV" type="varchar" length="50"  dropindex="useridname" addindex="useridname(userid, name(50))"/>
        <FIELD name="value" method="NO_CONV" type="varchar" length="255" />
      </FIELDS>
    </TABLE>
    <TABLE name="user_admins" />
    <TABLE name="user_coursecreators" />
    <TABLE name="course">
      <FIELDS>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
          <PHP_FUNCTION>
            migrate2utf8_course_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="fullname" method="PHP_FUNCTION" type="varchar" length="254">
          <PHP_FUNCTION>
            migrate2utf8_course_fullname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="shortname" method="PHP_FUNCTION" type="varchar" length="15" dropindex="shortname" addindex="shortname(shortname(15))">
          <PHP_FUNCTION>
            migrate2utf8_course_shortname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="idnumber" method="PHP_FUNCTION" type="varchar" length="100" dropindex="idnumber" addindex="idnumber(idnumber(100))">
          <PHP_FUNCTION>
            migrate2utf8_course_idnumber(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_summary(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="format" method="NO_CONV" type="varchar" length="10" default="topics"/>
        <FIELD name="modinfo" method="PHP_FUNCTION" type="longtext" length="0">
          <PHP_FUNCTION>
            migrate2utf8_course_modinfo(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="teacher" method="PHP_FUNCTION" type="varchar" length="100" default="Teacher">
          <PHP_FUNCTION>
            migrate2utf8_course_teacher(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="teachers" method="PHP_FUNCTION" type="varchar" length="100" default="Teachers">
          <PHP_FUNCTION>
            migrate2utf8_course_teachers(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="student" method="PHP_FUNCTION" type="varchar" length="100" default="Student">
          <PHP_FUNCTION>
            migrate2utf8_course_student(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="students" method="PHP_FUNCTION" type="varchar" length="100" default="Students">
          <PHP_FUNCTION>
            migrate2utf8_course_students(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="cost" method="PHP_FUNCTION" type="varchar" length="10">
          <PHP_FUNCTION>
            migrate2utf8_course_cost(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10" default="en_utf8">
          <PHP_FUNCTION>
            migrate2utf8_course_lang(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="user">
      <FIELDS>
        <FIELD name="auth" method="NO_CONV" type="varchar" length="20" dropindex="auth" addindex="auth(auth(20))" default="manual"/>
        <FIELD name="username" method="NO_CONV" type="varchar" length="100" dropindex="username" adduniqueindex="username(username(100))"/>
        <FIELD name="password" method="NO_CONV" type="varchar" length="32" />
        <FIELD name="idnumber" method="PHP_FUNCTION" type="varchar" length="64" dropindex="idnumber" addindex="idnumber(idnumber(64))">
          <PHP_FUNCTION>
            migrate2utf8_user_idnumber(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="firstname" method="PHP_FUNCTION" type="varchar" length="20" dropindex="user_firstname" addindex="user_firstname(firstname(20))">
          <PHP_FUNCTION>
            migrate2utf8_user_firstname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="lastname" method="PHP_FUNCTION" type="varchar" length="20" dropindex="user_lastname" addindex="user_lastname(lastname(20))">
          <PHP_FUNCTION>
            migrate2utf8_user_lastname(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="email" method="NO_CONV" type="varchar" length="100" dropindex="user_email" addindex="user_email(email(100))"/>
        <FIELD name="icq" method="NO_CONV" type="varchar" length="15" />
        <FIELD name="skype" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="yahoo" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="aim" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="msn" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="phone1" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="phone2" method="NO_CONV" type="varchar" length="20" />
        <FIELD name="institution" method="PHP_FUNCTION" type="varchar" length="40">
          <PHP_FUNCTION>
            migrate2utf8_user_institution(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="department" method="PHP_FUNCTION" type="varchar" length="30">
          <PHP_FUNCTION>
            migrate2utf8_user_department(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="address" method="PHP_FUNCTION" type="varchar" length="70">
          <PHP_FUNCTION>
            migrate2utf8_user_address(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="city" method="PHP_FUNCTION" type="varchar" length="20" dropindex="user_city" addindex="user_city(city(20))">
          <PHP_FUNCTION>
            migrate2utf8_user_city(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="country" method="NO_CONV" type="char" length="2" dropindex="user_country" addindex="user_country(country(2))"/>
        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
        <FIELD name="timezone" method="NO_CONV" type="varchar" length="100" />
        <FIELD name="lastIP" method="NO_CONV" type="varchar" length="15" />
        <FIELD name="secret" method="PHP_FUNCTION" type="varchar" length="15">
          <PHP_FUNCTION>
            migrate2utf8_user_secret(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="url" method="NO_CONV" type="varchar" length="255" />
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_user_description(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10">
          <PHP_FUNCTION>
            migrate2utf8_user_lang(RECORDID)
          </PHP_FUNCTION>
        </FIEND>
      </FIELDS>
    </TABLE>
  </TABLES>
</DBMIGRATION>
