<DBMIGRATION type="mod/exercise" VERSION="2005120100">
  <TABLES>
    <TABLE name="exercise_assessments">
      <FIELDS>
        <FIELD name="generalcomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
          <SQL_DETECT_USER>
           SELECT exa.userid
           FROM {$CFG->prefix}exercise_assessments exa
           WHERE exa.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
           SELECT ex.course
           FROM {$CFG->prefix}exercise ex,
                {$CFG->prefix}exercise_assessments exa
           WHERE ex.id = exa.exerciseid
                 AND exa.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
        <FIELD name="teachercomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
          <SQL_DETECT_USER>
           SELECT exa.userid
           FROM {$CFG->prefix}exercise_assessments exa
           WHERE exa.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
           SELECT ex.course
           FROM {$CFG->prefix}exercise ex,
                {$CFG->prefix}exercise_assessments exa
           WHERE ex.id = exa.exerciseid
                 AND exa.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="exercise_elements">
      <FIELDS>
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf_exercise_elements_description(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="exercise_grades">
      <FIELDS>
        <FIELD name="feedback" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf_exercise_grades_feedback(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="exercise_rubrics">
      <FIELDS>
        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
          <PHP_FUNCTION>
            migrate2utf_exercise_rubrics_description(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="exercise_submissions">
      <FIELDS>
        <FIELD name="title" method="PLAIN_SQL_UPDATE" type="varchar" length="100">
          <SQL_DETECT_USER>
           SELECT exs.userid
           FROM {$CFG->prefix}exercise_submissions exs
           WHERE exs.id = RECORDID
          </SQL_DETECT_USER>
          <SQL_DETECT_COURSE>
           SELECT ex.course
           FROM {$CFG->prefix}exercise ex,
                {$CFG->prefix}exercise_submissions exs
           WHERE ex.id = exs.exerciseid
                 AND exs.id = RECORDID
          </SQL_DETECT_COURSE>
        </FIELD>
      </FIELDS>
    </TABLE>
    <TABLE name="exercise">
      <FIELDS>
        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
          <PHP_FUNCTION>
            migrate2utf_exercise_name(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
          <PHP_FUNCTION>
            migrate2utf_exercise_password(RECORDID)
          </PHP_FUNCTION>
        </FIELD>
      </FIELDS>
    </TABLE>
  </TABLES>
</DBMIGRATION>
