Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

correct column datatype and default value
  • Loading branch information...
commit 7a3a4cff546e0dba91ec2dcc20a99032caa71af9 1 parent f172091
martinlanghoff authored
View
32 mod/lesson/db/postgres7.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;
}
View
15 mod/lesson/db/postgres7.sql
@@ -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',
View
2  mod/lesson/version.php
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.