From: paca70 Date: Tue, 2 Nov 2004 08:51:24 +0000 (+0000) Subject: Corrected typo in mysql.sql X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5b9ce58cdc554b5f726b874f7e0fa9fd8e042cb1;p=moodle.git Corrected typo in mysql.sql Added support for postgresql. BTW is it posible to use table_column() function also with mysql, that would make mysql-code easily portable to other database-files. --- diff --git a/mod/lesson/db/mysql.sql b/mod/lesson/db/mysql.sql index e8f69317ea..ddb39659fa 100644 --- a/mod/lesson/db/mysql.sql +++ b/mod/lesson/db/mysql.sql @@ -82,7 +82,7 @@ CREATE TABLE `prefix_lesson_attempts` ( `answerid` int(10) unsigned NOT NULL default '0', `retry` int(3) unsigned NOT NULL default '0', `correct` int(10) unsigned NOT NULL default '0', - `useranswer' text NOT NULL default '', + `useranswer` text NOT NULL default '', `timeseen` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY (`userid`) diff --git a/mod/lesson/db/postgres7.php b/mod/lesson/db/postgres7.php index 7cec72e717..57df935ed8 100644 --- a/mod/lesson/db/postgres7.php +++ b/mod/lesson/db/postgres7.php @@ -175,7 +175,20 @@ function lesson_upgrade($oldversion) { )"); } // CDC-FLAG end + if ($oldversion < 2004100400) { + //execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_attempts` ADD `useranswer` text NOT NULL AFTER correct"); + table_column('lesson_attempts', '', 'useranswer', 'text', '', '', '', 'NOT NULL', 'correct'); + } + + if ($oldversion < 2004100700) { + //execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice"); + table_column('lesson', '', 'modattempts', 'INT', '4', 'unsigned', '0', 'NOT NULL', 'practice'); + } + if ($oldversion < 2004102600) { + //execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_default` ADD `modattempts` tinyint(3) unsigned NOT NULL default '0' AFTER practice"); + table_column('lesson_default', '', 'modattempts', 'INT', '4', 'unsigned', '0', 'NOT NULL', 'practice'); + } return true; } diff --git a/mod/lesson/db/postgres7.sql b/mod/lesson/db/postgres7.sql index f4cb24e525..e6959cd3dd 100644 --- a/mod/lesson/db/postgres7.sql +++ b/mod/lesson/db/postgres7.sql @@ -3,6 +3,7 @@ CREATE TABLE prefix_lesson ( course INT8 NOT NULL default '0', name varchar(255) NOT NULL default '', practice INT NOT NULL DEFAULT '0', + modattempts INT4 NOT NULL DEFAULT '0', usepassword INT NOT NULL DEFAULT '0', password VARCHAR(32) NOT NULL default '', grade INT NOT NULL default '0', @@ -69,6 +70,7 @@ CREATE TABLE prefix_lesson_attempts ( answerid INT8 NOT NULL default '0', retry INT NOT NULL default '0', correct INT8 NOT NULL default '0', + useranswer text NOT NULL default '', timeseen INT8 NOT NULL default '0' ) ; CREATE INDEX prefix_lesson_attempts_userid_idx ON prefix_lesson_attempts (userid); @@ -86,6 +88,7 @@ CREATE TABLE prefix_lesson_default ( id SERIAL8 PRIMARY KEY, course INT8 NOT NULL default '0', practice INT NOT NULL default '0', + modattempts INT4 NOT NULL default '0', password varchar(32) NOT NULL default '', usepassword INT NOT NULL default '0', grade INT NOT NULL default '0',