Skip to content

Commit

Permalink
Corrected typo in mysql.sql
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paca70 committed Nov 2, 2004
1 parent 4300405 commit 5b9ce58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mod/lesson/db/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
13 changes: 13 additions & 0 deletions mod/lesson/db/postgres7.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions mod/lesson/db/postgres7.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand All @@ -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',
Expand Down

0 comments on commit 5b9ce58

Please sign in to comment.