Skip to content

Commit

Permalink
Added cppr_specific_database_fix_preparation_for_moodle_39_to_41_upgr…
Browse files Browse the repository at this point in the history
…ade.sql to be run before upgrading to Moodle 4.1.
  • Loading branch information
ctam committed Dec 15, 2023
1 parent 65bd594 commit b090d74
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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');

0 comments on commit b090d74

Please sign in to comment.