How to best bulk import posts if unable to use sample Ruby scripts?

Hey, I’m moving a ton of content over from my old (proprietary) forum software to a new Discourse forum.

I’m not a Ruby coder so I couldn’t really start with the example import scripts provided by Discourse… it’s just not a good solution for me. So I’m just calling the API to handle all the steps.

The problem is I’m running into a lot of issues along the way… rate limiting, mostly, but also issues with repeated forums, getting the message content through all the “reality checks” (for example: minimum post length, which I finally figured out to change to ‘1’ in the settings).

Is there any other/better option? Can I somehow push data into the database directly, or …?

If you know any programming languages starting with the existing import scripts is the way to go. The bulk import scripts directly modify the sql but they are still written in ruby.


Ok… I’ll look at the scripts… I’m an experienced coder in other languages, just not Ruby/RoR.

Ok I’m back from looking at the existing import scripts in github. :wink: From what I see, it looks very much like the code I’ve already written to do my importing… lots of loops to get the users, the topic and finally the messages. Special code to deal with attachments (uploading them separately, getting the Discourse internal URL, appending that to the message body).

Are there any special API calls or anything else I’m missing in these scripts that might help me? The issue isn’t that I can’t write my own import script (using the API), my issue is that it seems clunky and I wonder if there is a smoother/more elegant solution. If there are any “tricks” (like special API calls?) in the sample scripts that I can borrow in another language, I’d love to understand.

That’s why I recommended that you not use it.

Heh, yes, we have established that, and we have also established that I don’t know RoR, so investing the time to rewrite one of the existing scripts is not a good solution for me either. If you have any other recommendations that might help me out here :wink: I’d (sincerely) love to hear them. Thank you.

1 Like

Hi Eric,

The core migration scripts are a great starting place. A month ago I had also never programmed in Ruby before as well.

In fact, a few days ago I wrote a custom PHP script to help with migration (a long decade of PHP years behind me) but decided to rewrite in Ruby and “its a piece of cake” LOL

Now, I am a Ruby fan!

Ruby looked a bit strange to me at first but now its starting to make sense.

Just jump in feet first and you will be fine!

Or… hire one of the coders here to help you!


Thanks – yeah, learning RoR is on the list! :wink: