</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" />
+ <FIELD name="mtable" method="NO_CONV" type="varchar" length="30" dropindex="moduleaction"/>
+ <FIELD name="field" method="NO_CONV" type="varchar" length="50" />
+ <FIELD name="module" method="NO_CONV" type="varchar" length="30" />
+ <FIELD name="action" method="NO_CONV" type="varchar" length="40" addindex="moduleaction(module(30), action(40))"/>
</FIELDS>
</TABLE>
<TABLE name="message_contacts" />
table_column('user','lastname','lastname','varchar','100','','','not null');
}
+ if ($oldversion < 2006042000) {
+ // Look through table log_display and get rid of duplicates.
+ $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display');
+
+ // Drop the log_display table and create it back with an id field.
+ execute_sql("DROP TABLE {$CFG->prefix}log_display", false);
+
+ modify_database('', "CREATE TABLE prefix_log_display (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `module` varchar(30),
+ `action` varchar(40),
+ `mtable` varchar(30),
+ `field` varchar(50),
+ PRIMARY KEY (`id`)
+ ) TYPE=MyISAM");
+
+ // Add index to ensure that module and action combination is unique.
+ modify_database('', "ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`)");
+
+ // Insert the records back in, sans duplicates.
+ if ($rs && $rs->RecordCount() > 0) {
+ while (!$rs->EOF) {
+ $sql = "INSERT INTO {$CFG->prefix}log_display ".
+ "VALUES('', '".$rs->fields['module']."', ".
+ "'".$rs->fields['action']."', ".
+ "'".$rs->fields['mtable']."', ".
+ "'".$rs->fields['field']."')";
+
+ execute_sql($sql, false);
+ $rs->MoveNext();
+ }
+ }
+ }
+
return $result;
}
-?>
+?>
\ No newline at end of file
#
CREATE TABLE `prefix_log_display` (
+ `id` int(10) unsigned NOT NULL auto_increment,
`module` varchar(20) NOT NULL default '',
`action` varchar(20) NOT NULL default '',
`mtable` varchar(20) NOT NULL default '',
`field` varchar(40) NOT NULL default ''
) TYPE=MyISAM COMMENT='For a particular module/action, specifies a moodle table/field.';
+ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`);
# --------------------------------------------------------
#
table_column('course_modules','','visibleold','integer','1','unsigned','1','not null', 'visible');
}
+ if ($oldversion < 2006042000) {
+ // Look through table log_display and get rid of duplicates.
+ $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display');
+
+ // Drop the log_display table and create it back with an id field.
+ execute_sql("DROP TABLE {$CFG->prefix}log_display", false);
+
+ modify_database('', "CREATE TABLE prefix_log_display (
+ id SERIAL PRIMARY KEY,
+ module varchar(30) NOT NULL default '',
+ action varchar(40) NOT NULL default '',
+ mtable varchar(30) NOT NULL default '',
+ field varchar(50) NOT NULL default '')");
+
+ // Add index to ensure that module and action combination is unique.
+ modify_database('', 'CREATE INDEX prefix_log_display_moduleaction ON prefix_log_display (module,action)');
+
+ // Insert the records back in, sans duplicates.
+ if ($rs && $rs->RecordCount() > 0) {
+ while (!$rs->EOF) {
+ $sql = "INSERT INTO {$CFG->prefix}log_display ".
+ "VALUES('', '".$rs->fields['module']."', ".
+ "'".$rs->fields['action']."', ".
+ "'".$rs->fields['mtable']."', ".
+ "'".$rs->fields['field']."')";
+
+ execute_sql($sql, false);
+ $rs->MoveNext();
+ }
+ }
+ }
+
return $result;
}
CREATE INDEX prefix_log_info_idx ON prefix_log (info);
CREATE TABLE prefix_log_display (
- module varchar(20) NOT NULL default '',
- action varchar(20) NOT NULL default '',
- mtable varchar(20) NOT NULL default '',
- field varchar(40) NOT NULL default ''
+ id SERIAL PRIMARY KEY,
+ module varchar(30) NOT NULL default '',
+ action varchar(40) NOT NULL default '',
+ mtable varchar(30) NOT NULL default '',
+ field varchar(50) NOT NULL default ''
);
+CREATE INDEX prefix_log_display_moduleaction ON prefix_log_display (module,action);
CREATE TABLE prefix_message (
id SERIAL PRIMARY KEY,