Okay, folks, I have made a mess, and I would very much like to fix it.
For reasons that I shan't get into here, I have had to do a server migration the dumb and brutal way, with downloaded course backup .mbz files. I backed the classes up with the user data intact.
On the new server, I uploaded the user list from the old server to put the accounts in, as I assumed that they'd need to be there before pulling in the classes. I have since realized that when you back up user data in those .mbz files, it has the whole user in it. Would have been good to know...
Here's where the problem lies, though: I started getting errors on course restore because when I uploaded the user list, I standardized the email addresses to the university email address, which meant changing some people's accounts.
The course restore sees this as a different person and refuses to go through with the user data at all.
Realizing what the problem was, and that the .mbz files had the full users in them, I decided to just delete the student user accounts and let them come back in with classes, and then upload them again to overwrite the offending mail addresses and add back accounts that were in no class this past semester.
This results in no student accounts being restored, probably because (as I recently learned) when you delete an account in Moodle, all it does is flag it as deleted in the database. So I think it's seeing that there was indeed an account with that username, but it's since been deleted, so it doesn't import.
So, database folks, what's my way around this? Here are the ideas I have:
- Go into the database itself and just delete all the records that have the deleted flag and try again. But will this gorf something else? I don't know that much about databases...
- Go into the database and flip all those deleted flags to 0 and then go and change email addresses as necessary so the restores go through with user data. (See concern about gorfing something.)
- Re-upload those accounts with the old email addresses. But will it make entirely new accounts or simply update the ones in the database to be deleted=0 and impute the new email address? If it makes new accounts, I imagine I'll be right back where I am now.
- Re-upload the accounts with the "new" uni email addresses, and when I run into an issue with a restore, just change that handful of students' email addresses back to their old ones and try again? But, again, will that result in entirely new entries in the database, or simply "undeleted" ones?