<TABLE NAME="enrol_authorize" COMMENT="Holds all known information about authorize.net transactions" NEXT="enrol_authorize_refunds">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="paymentmethod"/>
- <FIELD NAME="paymentmethod" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="cc" SEQUENCE="false" ENUM="true" ENUMVALUES="'cc', 'echeck'" PREVIOUS="id" NEXT="refundinfo"/>
+ <FIELD NAME="paymentmethod" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="cc" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="refundinfo"/>
<FIELD NAME="refundinfo" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="paymentmethod" NEXT="ccname"/>
<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"/>
$dbman->add_index($table, $index);
}
+ /// Dropping all enums/check contraints from core. MDL-18577
+ if ($result && $oldversion < 2009042700) {
+
+ /// Changing list of values (enum) of field paymentmethod on table enrol_authorize to none
+ $table = new xmldb_table('enrol_authorize');
+ $field = new xmldb_field('paymentmethod', XMLDB_TYPE_CHAR, '6', null, XMLDB_NOTNULL, null, null, null, 'cc', 'id');
+
+ /// Launch change of list of values for field paymentmethod
+ $dbman->change_field_enum($table, $field);
+ }
+
return $result;
}
<?php // $Id$
-$plugin->version = 2008092700;
+$plugin->version = 2009042700;
$plugin->requires = 2007101507;
?>
$string['ddltablealreadyexists'] = 'Table \"$a\" already exists';
$string['ddltablenotexist'] = 'Table \"$a\" does not exist';
$string['ddlunknownerror'] = 'Unknown DDL library error';
+$string['ddlunsupportedenums'] = 'Field \"$a\" contains enum info. Enums support has been dropped in Moodle 2.0. Please modify your code to avoid them completely. If you are already using them, please use \$dbman->change_field_enum(\$table, \$field); in your upgrade scripts to drop them ASAP';
$string['ddlxmlfileerror'] = 'XML database file errors found';
$string['dmlreadexception'] = 'Error reading from database';
$string['dmlwriteexception'] = 'Error writing to database';
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="timeend"/>
<FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id of role for the aggregates" PREVIOUS="timeend" NEXT="stattype"/>
- <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="true" ENUMVALUES="'enrolments', 'activity', 'logins'" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
+ <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="false" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
<FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat1. usually used for reads" PREVIOUS="stattype" NEXT="stat2"/>
<FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat2. usually used for writes." PREVIOUS="stat1"/>
</FIELDS>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="timeend"/>
<FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id of role for the aggregates" PREVIOUS="timeend" NEXT="stattype"/>
- <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="true" ENUMVALUES="'enrolments', 'activity', 'logins'" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
+ <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="false" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
<FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat1. usually used for reads" PREVIOUS="stattype" NEXT="stat2"/>
<FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat2. usually used for writes." PREVIOUS="stat1"/>
</FIELDS>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="timeend"/>
<FIELD NAME="timeend" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id of role for the aggregates" PREVIOUS="timeend" NEXT="stattype"/>
- <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="true" ENUMVALUES="'enrolments', 'activity', 'logins'" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
+ <FIELD NAME="stattype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="activity" SEQUENCE="false" ENUM="false" COMMENT="type of stat" PREVIOUS="roleid" NEXT="stat1"/>
<FIELD NAME="stat1" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat1. usually used for reads" PREVIOUS="stattype" NEXT="stat2"/>
<FIELD NAME="stat2" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="stat2. usually used for writes." PREVIOUS="stat1"/>
</FIELDS>
<FIELD NAME="rating" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="uniquehash" NEXT="format"/>
<FIELD NAME="format" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="rating" NEXT="attachment"/>
<FIELD NAME="attachment" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="attachment" PREVIOUS="format" NEXT="publishstate"/>
- <FIELD NAME="publishstate" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="draft" SEQUENCE="false" ENUM="true" ENUMVALUES="'draft', 'site', 'public'" PREVIOUS="attachment" NEXT="lastmodified"/>
+ <FIELD NAME="publishstate" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="draft" SEQUENCE="false" ENUM="false" PREVIOUS="attachment" NEXT="lastmodified"/>
<FIELD NAME="lastmodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="publishstate" NEXT="created"/>
<FIELD NAME="created" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastmodified" NEXT="usermodified"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="created"/>
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
upgrade_main_savepoint($result, 2009042600);
}
+ /// Dropping all enums/check contraints from core. MDL-18577
+ if ($result && $oldversion < 2009042700) {
+
+ /// Changing list of values (enum) of field stattype on table stats_daily to none
+ $table = new xmldb_table('stats_daily');
+ $field = new xmldb_field('stattype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'activity', 'roleid');
+
+ /// Launch change of list of values for field stattype
+ $dbman->change_field_enum($table, $field);
+
+ /// Changing list of values (enum) of field stattype on table stats_weekly to none
+ $table = new xmldb_table('stats_weekly');
+ $field = new xmldb_field('stattype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'activity', 'roleid');
+
+ /// Launch change of list of values for field stattype
+ $dbman->change_field_enum($table, $field);
+
+ /// Changing list of values (enum) of field stattype on table stats_monthly to none
+ $table = new xmldb_table('stats_monthly');
+ $field = new xmldb_field('stattype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'activity', 'roleid');
+
+ /// Launch change of list of values for field stattype
+ $dbman->change_field_enum($table, $field);
+
+ /// Changing list of values (enum) of field publishstate on table post to none
+ $table = new xmldb_table('post');
+ $field = new xmldb_field('publishstate', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'draft', 'attachment');
+
+ /// Launch change of list of values for field publishstate
+ $dbman->change_field_enum($table, $field);
+
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2009042700);
+ }
+
return $result;
}
throw new ddl_exception('ddltablealreadyexists', $xmldb_table->getName());
}
+ /// Iterate over all fields in table, finding any attempt to add one field with enum info, throw exception
+ $xmldb_fields = $xmldb_table->getFields();
+ foreach ($xmldb_fields as $xmldb_field) {
+ if ($xmldb_field->getEnum()) {
+ throw new ddl_exception('ddlunsupportedenums', $xmldb_table->getName() . '->' . $xmldb_field->getName());
+ }
+ }
+
if (!$sqlarr = $this->generator->getCreateTableSQL($xmldb_table)) {
throw new ddl_exception('ddlunknownerror', null, 'table create sql not generated');
}
$this->drop_temp_table($xmldb_table);
}
+ /// Iterate over all fields in table, finding any attempt to add one field with enum info, throw exception
+ $xmldb_fields = $xmldb_table->getFields();
+ foreach ($xmldb_fields as $xmldb_field) {
+ if ($xmldb_field->getEnum()) {
+ throw new ddl_exception('ddlunsupportedenums', $xmldb_table->getName() . '->' . $xmldb_field->getName());
+ }
+ }
+
if (!$sqlarr = $this->generator->getCreateTempTableSQL($xmldb_table)) {
throw new ddl_exception('ddlunknownerror', null, 'temp table create sql not generated');
}
' cannot be added. Not null fields added to non empty tables require default value. Create skipped');
}
+ /// Detect any attempt to add one field with enum info, throw exception
+ if ($xmldb_field->getEnum()) {
+ throw new ddl_exception('ddlunsupportedenums', $xmldb_table->getName() . '->' . $xmldb_field->getName());
+ }
+
if (!$sqlarr = $this->generator->getAddFieldSQL($xmldb_table, $xmldb_field)) {
throw new ddl_exception('ddlunknownerror', null, 'addfield sql not generated');
}
/// If enum is defined, we're going to create it, check it doesn't exist.
if ($xmldb_field->getEnum()) {
- if ($this->check_constraint_exists($xmldb_table, $xmldb_field)) {
- debugging('Enum for ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
- ' already exists. Create skipped', DEBUG_DEVELOPER);
- return; //Enum exists, nothing to do
- }
+ throw new ddl_exception('ddlunsupportedenums', $xmldb_table->getName() . '->' . $xmldb_field->getName());
} else { /// Else, we're going to drop it, check it exists
if (!$this->check_constraint_exists($xmldb_table, $xmldb_field)) {
debugging('Enum for ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="type"/>
- <FIELD NAME="type" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="general" SEQUENCE="false" ENUM="true" ENUMVALUES="'single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'" PREVIOUS="course" NEXT="name"/>
+ <FIELD NAME="type" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="general" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="intro"/>
<FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="text format of intro field" PREVIOUS="intro" NEXT="assessed"/>
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
upgrade_mod_savepoint($result, 2009042004, 'forum');
}
+ /// Dropping all enums/check contraints from core. MDL-18577
+ if ($result && $oldversion < 2009042700) {
+
+ /// Changing list of values (enum) of field type on table forum to none
+ $table = new xmldb_table('forum');
+ $field = new xmldb_field('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'general', 'course');
+
+ /// Launch change of list of values for field type
+ $dbman->change_field_enum($table, $field);
+
+ /// forum savepoint reached
+ upgrade_mod_savepoint($result, 2009042700, 'forum');
+ }
+
return $result;
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009042004;
+$module->version = 2009042700;
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 60;
<FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="intro text field format" PREVIOUS="intro" NEXT="pagename"/>
<FIELD NAME="pagename" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="wtype"/>
- <FIELD NAME="wtype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="group" SEQUENCE="false" ENUM="true" ENUMVALUES="'teacher', 'group', 'student'" PREVIOUS="pagename" NEXT="ewikiprinttitle"/>
+ <FIELD NAME="wtype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="group" SEQUENCE="false" ENUM="false" PREVIOUS="pagename" NEXT="ewikiprinttitle"/>
<FIELD NAME="ewikiprinttitle" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="wtype" NEXT="htmlmode"/>
<FIELD NAME="htmlmode" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ewikiprinttitle" NEXT="ewikiacceptbinary"/>
<FIELD NAME="ewikiacceptbinary" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="htmlmode" NEXT="disablecamelcase"/>
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
upgrade_mod_savepoint($result, 2009042001, 'wiki');
}
+/// Dropping all enums/check contraints from core. MDL-18577
+ if ($result && $oldversion < 2009042700) {
+
+ /// Changing list of values (enum) of field wtype on table wiki to none
+ $table = new xmldb_table('wiki');
+ $field = new xmldb_field('wtype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'group', 'pagename');
+
+ /// Launch change of list of values for field wtype
+ $dbman->change_field_enum($table, $field);
+
+ /// wiki savepoint reached
+ upgrade_mod_savepoint($result, 2009042700, 'wiki');
+ }
+
return $result;
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009042001; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2009042700; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2009041700; // The current module version (Date: YYYYMMDDXX)
$module->cron = 3600; // Period for cron to check this module (secs)
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2009042600; // YYYYMMDD = date of the last version bump
+ $version = 2009042700; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20090427)'; // Human-friendly version name