Our importers in general offer a framework for doing this during migrations. I would review the source on them.
discourse/script/import_scripts at main · discourse/discourse · GitHub
Our importers in general offer a framework for doing this during migrations. I would review the source on them.
discourse/script/import_scripts at main · discourse/discourse · GitHub