Glad you figured out the issue.
Yes, there is, however I’d suggest considering this in some depth first as a community management issue before you consider how to do this programmatically. If you haven’t already done a deep-dive on trust levels check out
Then, if it were me, I’d identify a few groups of users (perhaps your old solution still had some kind of user grouping?) that you want to grant higher trust levels, i.e. 3 and 4. This will be mostly a manual process. For the lower levels, i.e. 1 and 2, it’d have to be in bulk. You could perhaps map some user metadata from your old forum to the trust level heuristics. Or come up with some basic rules. The code itself is relatively simple, but I wouldn’t just copy/paste the code in the topic for 100k users.
More broadly, your best bet would probably be for your discourse hosting provider to handle the migration for you, as this is something they often deal with and will have sophisticated solutions for.