<DBMIGRATION type="mod/lesson" VERSION="2005120100">
  <TABLES>
    <TABLE name="lesson_branch" />
    <TABLE name="lesson_grades" />
    <TABLE name="lesson_timer" />
    <TABLE name="lesson_attempts">
      <FIELDS>
        <FIELD name="useranswer" method="PLAIN_SQL_UPDATE" type="text" length="0">
          <SQL_DETECT_USER>
           SELECT la.userid
           FROM {$CFG->prefix}lesson_attempts la
           WHERE la.id=RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
           SELECT l.course
           FROM {$CFG->prefix}lesson l,
                {$CFG->prefix}lesson_attempts la
           WHERE l.id = la.lessonid
                 AND la.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="lesson_high_scores">
      <FIELDS>
        <FIELD name="nickname" method="NO_CONV" type="varchar" length="5" />
      </FIELDS>
    </TABLE>
    <TABLE name="lesson_answers">
      <FIELDS>
        <FIELD name="answer" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_lesson_answers_answer(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="response" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_lesson_answers_response(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="lesson_default">
      <FIELDS>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
          <PHP_FUNCTION>
           migrate2utf8_lesson_default_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="bgcolor" method="NO_CONV" type="varchar" length="7" default="#FFFFFF" />
      </FIELDS>
    </TABLE>
    <TABLE name="lesson_pages">
      <FIELDS>
        <FIELD name="title" method="PHP_FUNCTION" type="varchar" length="255">
          <PHP_FUNCTION>
            migrate2utf8_lesson_pages_title(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="contents" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf8_lesson_pages_content(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="lesson">
      <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
          <PHP_FUNCTION>
           migrate2utf8_lesson_name(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
          <PHP_FUNCTION>
           migrate2utf8_lesson_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="conditions" method="NO_CONV" type="text" length="0" />
        <FIELD name="mediafile" method="NO_CONV" type="varchar" length="255" />
        <FIELD name="bgcolor" method="NO_CONV" type="varchar" length="7" default="#FFFFFF" />
      </FIELDS>
    </TABLE>
  </TABLES>
</DBMIGRATION>
