--- /home/dan/moodle/moodle/lib/db/upgrade.php 2008-01-11 15:44:27.000000000 +0000 +++ upgrade.php 2008-01-13 15:00:55.000000000 +0000 @@ -1,4 +1,4 @@ -prefix}course c + LEFT OUTER JOIN {$CFG->prefix}course_categories cc + ON c.category = cc.id + SET c.category = + (SELECT id FROM + {$CFG->prefix}course_categories + WHERE parent = 0 + ORDER BY sortorder LIMIT 1) + WHERE cc.id IS NULL AND c.id != ".SITEID; + execute_sql($unorphansql, true); + /// make sure category depths, parents and paths are ok, categories from 1.5 may not be properly initialized (MDL-12585) upgrade_fix_category_depths();