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

correct column datatype and default value
This commit is contained in:
martinlanghoff
2006-05-17 06:19:17 +00:00
parent ec29c403be
commit 4ff35d69bc
3 changed files with 33 additions and 16 deletions
+32
View File
@@ -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;
}
-15
View File
@@ -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',
+1 -1
View File
@@ -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)