Wow, thanks for the code!
I don’t have a staging server for this discourse instance, but i can take a backup and then run the code very early tomorrow morning when there is likely not much (or any) traffic so i can restore immediately if there’s an issue.
Thanks so much @pfaffman.