From 9a2eb087aa8f19169ab0b4f1bb9da437f7e614f2 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 17 May 2006 06:35:14 +0000 Subject: [PATCH] moodle16cleanup: mod/hotpot set the correct column datatype and default value --- mod/hotpot/db/postgres7.php | 46 ++++++++++++++++++++++++++++++++++++- mod/hotpot/version.php | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/mod/hotpot/db/postgres7.php b/mod/hotpot/db/postgres7.php index fc972b1424..e5d5252217 100644 --- a/mod/hotpot/db/postgres7.php +++ b/mod/hotpot/db/postgres7.php @@ -41,6 +41,50 @@ function hotpot_upgrade($oldversion) { require_once $update_to_v2; $ok = $ok && hotpot_update_to_v2_1_18(); } - return $ok; + + + if ($oldversion < 2006050201) { + + modify_database('', 'ALTER TABLE prefix_hotpot + ALTER COLUMN studentfeedbackurl SET DEFAULT \'\', + ALTER COLUMN studentfeedbackurl SET NOT NULL, + ALTER COLUMN clickreporting SET DEFAULT 0, + ALTER COLUMN studentfeedback SET DEFAULT 0'); + + modify_database('', 'ALTER TABLE prefix_hotpot_strings + ALTER COLUMN string SET DEFAULT \'\''); + + modify_database('', 'ALTER TABLE prefix_hotpot_responses + ALTER COLUMN hints TYPE int2, + ALTER COLUMN hints SET DEFAULT 0, + ALTER COLUMN ignored SET DEFAULT \'\', + ALTER COLUMN ignored SET NOT NULL, + ALTER COLUMN score TYPE int2, + ALTER COLUMN score SET DEFAULT 0, + ALTER COLUMN correct SET DEFAULT \'\', + ALTER COLUMN correct SET NOT NULL, + ALTER COLUMN weighting TYPE int2, + ALTER COLUMN weighting SET DEFAULT 0, + ALTER COLUMN wrong SET DEFAULT \'\', + ALTER COLUMN wrong SET NOT NULL, + ALTER COLUMN checks TYPE int2, + ALTER COLUMN checks SET DEFAULT 0, + ALTER COLUMN clues TYPE int2, + ALTER COLUMN clues SET DEFAULT 0'); + + modify_database('', 'ALTER TABLE prefix_hotpot_questions + ALTER COLUMN "type" SET DEFAULT 0'); + + modify_database('', 'ALTER TABLE prefix_hotpot_attempts + ALTER COLUMN penalties TYPE smallint, + ALTER COLUMN penalties SET DEFAULT 0, + ALTER COLUMN score TYPE smallint, + ALTER COLUMN score SET DEFAULT 0, + ALTER COLUMN status SET DEFAULT 1'); + + } + + + return $ok; } ?> diff --git a/mod/hotpot/version.php b/mod/hotpot/version.php index 01536b46ef..478726b5f6 100644 --- a/mod/hotpot/version.php +++ b/mod/hotpot/version.php @@ -3,7 +3,7 @@ /// Code fragment to define the version of hotpot /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006050200; // release date of this version (see note below) +$module->version = 2006050201; // release date of this version (see note below) $module->release = 'v2.1.19'; // human-friendly version name (used in mod/hotpot/lib.php) $module->cron = 0; // period for cron to check this module (secs) // interpretation of YYYYMMDDXY version numbers -- 2.39.5