Skip to content
Permalink
Browse files

moodle16cleanup: mod/lesson drop unused table lesson_essay, set the

correct column datatype and default value
  • Loading branch information...
martinlanghoff
martinlanghoff committed May 17, 2006
1 parent ec29c40 commit 4ff35d69bc164c4b59ba56257a79197877be0df5
Showing with 33 additions and 16 deletions.
  1. +32 −0 mod/lesson/db/postgres7.php
  2. +0 −15 mod/lesson/db/postgres7.sql
  3. +1 −1 mod/lesson/version.php
@@ -312,6 +312,38 @@ function lesson_upgrade($oldversion) {
table_column('lesson_default', '', 'mediawidth', 'int', '10', 'unsigned', '650', 'not null', 'retake');
}
if ($oldversion < 2006050101) {
// drop the unused table
execute_sql('DROP TABLE '.$CFG->prefix.'lesson_essay', false);
// properly set the correct default values
modify_database('', 'ALTER TABLE prefix_lesson
ALTER COLUMN activitylink TYPE int8,
ALTER COLUMN activitylink SET DEFAULT 0,
ALTER COLUMN dependency TYPE int8,
ALTER COLUMN dependency SET DEFAULT 0');
modify_database('', 'ALTER TABLE prefix_lesson_timer
ALTER COLUMN lessontime SET DEFAULT 0,
ALTER COLUMN lessonid SET DEFAULT 0,
ALTER COLUMN userid SET DEFAULT 0,
ALTER COLUMN starttime SET DEFAULT 0');
modify_database('', 'ALTER TABLE prefix_lesson_branch
ALTER COLUMN lessonid SET DEFAULT 0,
ALTER COLUMN timeseen SET DEFAULT 0,
ALTER COLUMN userid SET DEFAULT 0,
ALTER COLUMN retry SET DEFAULT 0,
ALTER COLUMN pageid SET DEFAULT 0,
ALTER COLUMN flag SET DEFAULT 0');
modify_database('', 'ALTER TABLE prefix_lesson_high_scores
ALTER COLUMN nickname SET DEFAULT \'\',
ALTER COLUMN lessonid SET DEFAULT 0,
ALTER COLUMN gradeid SET DEFAULT 0,
ALTER COLUMN userid SET DEFAULT 0');
}
return true;
}
@@ -156,21 +156,6 @@ CREATE TABLE prefix_lesson_branch
timeseen INT8 not null default '0'
);

CREATE TABLE prefix_lesson_essay
( id SERIAL8 PRIMARY KEY,
lessonid INT8 not null default '0',
userid INT8 not null default '0',
pageid INT8 not null default '0',
answerid INT8 not null default '0',
try INT8 not null default '0',
answer text not null default '',
graded INT not null default 0,
score INT8 not null default 0,
response text not null default '',
sent INT not null default 0,
timesubmitted INT8 not null default '0'
);

CREATE TABLE prefix_lesson_high_scores
( id SERIAL8 PRIMARY KEY,
lessonid INT8 not null default '0',
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2006050100; // The current module version (Date: YYYYMMDDXX)
$module->version = 2006050101; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)

0 comments on commit 4ff35d6

Please sign in to comment.
You can’t perform that action at this time.