<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="enrol/authorize/db" VERSION="20061117" COMMENT="XMLDB file for Moodle enrol/authorize"
+<XMLDB PATH="enrol/authorize/db" VERSION="20080927" COMMENT="XMLDB file for Moodle enrol/authorize"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<FIELD NAME="ccname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="refundinfo" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ccname" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="transid"/>
- <FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
+ <FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
<FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="settletime"/>
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="amount"/>
<FIELD NAME="currency" TYPE="char" LENGTH="3" NOTNULL="true" DEFAULT="USD" SEQUENCE="false" ENUM="false" PREVIOUS="amount"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" />
+ <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid" NEXT="userid"/>
<FIELD NAME="orderid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="status"/>
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="orderid" NEXT="amount"/>
<FIELD NAME="amount" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="transid"/>
- <FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
+ <FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid"/>
</FIELDS>
<KEYS>
$dbman = $DB->get_manager();
$result = true;
-//===== 1.9.0 upgrade line ======//
+ //===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2008020500 && is_enabled_enrol('authorize')) {
require_once($CFG->dirroot.'/enrol/authorize/localfuncs.php');
}
}
+ if ($result && $oldversion < 2008092700) {
+ /// enrol_authorize.transid
+ /// Define index transid (not unique) to be dropped form enrol_authorize
+ $table = new xmldb_table('enrol_authorize');
+ $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ /// Changing precision of field transid on table enrol_authorize to (20)
+ $table = new xmldb_table('enrol_authorize');
+ $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'userid');
+ $dbman->change_field_precision($table, $field);
+
+ /// Launch add index transid again
+ $table = new xmldb_table('enrol_authorize');
+ $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
+ $dbman->add_index($table, $index);
+
+ /// enrol_authorize_refunds.transid
+ /// Define index transid (not unique) to be dropped form enrol_authorize_refunds
+ $table = new xmldb_table('enrol_authorize_refunds');
+ $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ /// Changing precision of field transid on table enrol_authorize_refunds to (20)
+ $table = new xmldb_table('enrol_authorize_refunds');
+ $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, null, null, '0', 'amount');
+ $dbman->change_field_precision($table, $field);
+
+ /// Launch add index transid again
+ $table = new xmldb_table('enrol_authorize_refunds');
+ $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
+ $dbman->add_index($table, $index);
+ }
+
return $result;
}