Are there are any hidden gotchas around restoring users, domains, courses, or enrollments, such as deleted data or broken relationships? I have been writing a tool to undelete accidentally-deleted domains, courses, and users. After restoring a course or a user, we've found that any enrollments related to the course/user have also been deleted. So to restore a deleted user or course to its pre-deleted state, you need to restore the entity's enrollments as well. That seems to do the trick, from what I can tell. (For example, all syllabus items seem to be correctly connected to the undeleted course, and past grades are still there for the restored user's enrollment.) Is there any other nuance that we need to take into account?
For the viewers following along at home, the following pattern is super useful for this find-and-restore process. I'm showing an example for user, but you can exchange user for course, domain, enrollment, etc.
- Find deleted entity: cmd=listusers&show=deleted&domain=0&text=john&query=/modifieddate>2016-09-20
- Restore entity: cmd=restoreuser&userid=123456789
The exact query parameters vary from entity to entity, but the format is basically the same.