Changes throughout Moodle to remove any reserved words from the

Moodle tables.

ie user -> userid in many tables, plus in user_students
   start -> starttime and end -> endtime

I've just done all this as carefully as I could ... I don't think
I missed anything but it's pretty intensive work and I'd be fooling myself
if I didn't think I'd missed a couple.

Note that this version should pretty much be able to bootstrap itself
using PostgreSQL now ... but this is untested
This commit is contained in:
moodler 2002-12-23 09:39:26 +00:00
parent 1f48942e7d
commit ebc3bd2b24
68 changed files with 277 additions and 461 deletions

View file

@ -24,6 +24,11 @@ function quiz_upgrade($oldversion) {
execute_sql(" ALTER TABLE `quiz_answers` CHANGE `feedback` `feedback` TEXT NOT NULL ");
}
if ($oldversion < 2002122300) {
execute_sql("ALTER TABLE `quiz_grades` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `quiz_attempts` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
}
return true;
}

View file

@ -55,7 +55,7 @@ CREATE TABLE `prefix_quiz_answers` (
CREATE TABLE `prefix_quiz_attempts` (
`id` int(10) unsigned NOT NULL auto_increment,
`quiz` int(10) unsigned NOT NULL default '0',
`user` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
`attempt` smallint(6) NOT NULL default '0',
`sumgrades` varchar(10) NOT NULL default '0.0',
`timestart` int(10) unsigned NOT NULL default '0',
@ -86,7 +86,7 @@ CREATE TABLE `prefix_quiz_categories` (
CREATE TABLE `prefix_quiz_grades` (
`id` int(10) unsigned NOT NULL auto_increment,
`quiz` int(10) unsigned NOT NULL default '0',
`user` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
`grade` varchar(10) NOT NULL default '0.0',
`timemodified` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)

View file

@ -6,24 +6,6 @@ function quiz_upgrade($oldversion) {
global $CFG;
if ($oldversion < 2002101800) {
execute_sql(" ALTER TABLE `quiz_attempts` ".
" ADD `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL AFTER `sumgrades` , ".
" ADD `timefinish` INT(10) UNSIGNED DEFAULT '0' NOT NULL AFTER `timestart` ");
execute_sql(" UPDATE `quiz_attempts` SET timestart = timemodified ");
execute_sql(" UPDATE `quiz_attempts` SET timefinish = timemodified ");
}
if ($oldversion < 2002102101) {
execute_sql(" DELETE FROM log_display WHERE module = 'quiz' ");
execute_sql(" INSERT INTO log_display VALUES ('quiz', 'view', 'quiz', 'name') ");
execute_sql(" INSERT INTO log_display VALUES ('quiz', 'report', 'quiz', 'name') ");
execute_sql(" INSERT INTO log_display VALUES ('quiz', 'attempt', 'quiz', 'name') ");
execute_sql(" INSERT INTO log_display VALUES ('quiz', 'submit', 'quiz', 'name') ");
}
if ($oldversion < 2002102600) {
execute_sql(" ALTER TABLE `quiz_answers` CHANGE `feedback` `feedback` TEXT NOT NULL ");
}
return true;
}

View file

@ -52,7 +52,7 @@ CREATE TABLE quiz_answers (
CREATE TABLE quiz_attempts (
id SERIAL PRIMARY KEY,
quiz integer NOT NULL default '0',
"user" integer NOT NULL default '0',
userid integer NOT NULL default '0',
attempt integer NOT NULL default '0',
sumgrades varchar(10) NOT NULL default '0.0',
timestart integer NOT NULL default '0',
@ -81,7 +81,7 @@ CREATE TABLE quiz_categories (
CREATE TABLE quiz_grades (
id SERIAL PRIMARY KEY,
quiz integer NOT NULL default '0',
"user" integer NOT NULL default '0',
userid integer NOT NULL default '0',
grade varchar(10) NOT NULL default '0.0',
timemodified integer NOT NULL default '0'
);