From b090d74836a94a743ccd2aa4221541b6dfd58122 Mon Sep 17 00:00:00 2001 From: Carson Tam Date: Fri, 15 Dec 2023 13:39:10 -0800 Subject: [PATCH] Added cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgrade.sql to be run before upgrading to Moodle 4.1. --- ...fix_preparation_for_moodle_39_to_41_upgrade.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgrade.sql diff --git a/cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgrade.sql b/cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgrade.sql new file mode 100644 index 0000000000000..7a262fa9482c6 --- /dev/null +++ b/cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgrade.sql @@ -0,0 +1,14 @@ +-- Make a back up of the tables we are about to change +CREATE TABLE mdl_user_info_category_original AS SELECT * FROM mdl_user_info_category; +CREATE TABLE mdl_user_info_field_original AS SELECT * FROM mdl_user_info_field; + +-- Create a new user field category on user_info_category table +-- Also fix the sortorder +UPDATE mdl_user_info_category SET sortorder = 3 WHERE name LIKE 'Voluntary Self-Identification of Disability'; +INSERT INTO mdl_user_info_category VALUES (3, 'Programs', 2); + +-- Change categoryid from 1 to 3 (the one we just created for 'Programs') in mdl_user_info_field, except for the ones created by Moodle +UPDATE mdl_user_info_field SET categoryid = 3 WHERE categoryid = 1 AND datatype <> 'social'; + +-- Turn off required on these fields +UPDATE mdl_user_info_field SET required = 0 WHERE shortname IN ('LHD','age','education','origin', 'race', 'sex', 'orientation', 'orgtype', 'PartLHD', 'SoC', 'Tribal', 'gender', 'jobtitle', 'EngProf', 'spanprof', 'Reserve', 'Pathways');